0
0

More than 3 years have passed since last update.

masterブランチで作業してしまった時の対処法

Posted at

<手順>

1, まずは修正内容を確認する。

$ git status  #ターミナルに作業した内容、変更した内容が出てくる

2, 修正内容を別の場所に一時保管する。

$ git stash 

その後もう一度git statusをすると先ほどの修正内容はなくなり、ターミナルに下記のような文章が出るはず。

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

3, 本来作業をしたかったブランチに切り替えorブランチ作り切り替える。

git checkout -b ○○○

4, 一時保管していた内容を切り替えたブランチに適用する。

git stash apply
0
0
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
0
0