Migrate the code you are editing to another branch when you accidentally start implementing it on master.

programming

The one I do quite a bit. There are people who start implementing the one that has been clone as it is and realize that it is not brunched by trying to commit it, right?

Migrate what you’re editing to another branch

Run the following command while you want to migrate to another branch

$ git stash
Saved working directory and index state WIP on master: 4dbabbf Merge pull request #10 dev into master

Then, the changes are written to the temporary storage area (?) Called the stash list.

The list of changes now recorded can be checked with the following command.

$ git stash list
stash@{0}: WIP on master: 4dbabbf Merge pull request #10 dev into master

Go to the branch where you want to apply the changes

$ git branch dev-01
$ git checkout dev-01

Write changes compared to the moved branch

$ git stash apply

Reference

Stash|サル先生のGit入門【プロジェクト管理ツールBacklog】
タイトルとURLをコピーしました