Gitでローカルで変更してしまった後から別のbranchにcommitしておきたいときの要点だけ

これってどうやるのかと思ってたけど、git stashを使えば良さそう。


1.ローカルにcloneしたあとに何か変更してしまって、結果いい感じになったとします
2.git stashでローカルの変更を一時的に退避します。

$git stash

3.変更をコミットするブランチを作成する

$git checkout -b new-branch-with-cool-feature

4.stashした変更点をpopします

$git stash pop

5.変更点をコミットします

$git commit -a -m “some comments here”

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA