Help us understand the problem. What is going on with this article?

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

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

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

作業内容を退避させる

$ git stash save

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

新ブランチに移動

$ git checkout -b development

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

$ git stash pop

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした