Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What is going on with this article?
@keitah

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

More than 1 year has passed since last update.

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

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

作業内容を退避させる

$ git stash save

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

新ブランチに移動

$ git checkout -b development

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

$ git stash pop

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

2
Help us understand the problem. What is going on with this article?
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
keitah
インフラエンジニアとして勤務しています。 AWS CLF/SAA/SOA取得 LPIC: Level-2 Cisco:CCNA

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
2
Help us understand the problem. What is going on with this article?