1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Git 間違ってmasterで作業してしまった時のコマンド

Posted at

思わずdevelopmenntのつもりで作業してしまった! または止むを得ずmasterで作業せざるを得なかった場合のコマンド備忘録

特にデプロイ確認の際には本番環境で作業せざるをえない。

#作業内容を退避させる

$ git stash save

これでmasterで作業した分を一時保存

#新ブランチに移動

$ git checkout -b development

#新ブランチで作業内容を復元

$ git stash pop

これにて マスターの作業内容が無事に新ブランチに移ったとさ。 チャンチャン!

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?