I want to change my branch from branch1
to branch2
but changes of branch1
is overriding changes of branch2
so git is not allowing me to checkout note : I don't want to commit changes to branch1
commands I have tried
我想将我的分支从branch1更改为branch2但是branch1的更改覆盖了branch2的更改,因此git不允许我签出注释:我不想提交对我尝试过的branch1命令的更改
git checkout branch2
1 个解决方案
#1
1
Seems like git stash is what you need. git stash
will take your outstanding changes and record them in git's data directory, then revert the directory to a clean state. Then you can git checkout branch2
and git stash pop
to get your changes back.
好像git stash就是你所需要的。 git stash将获取您未完成的更改并将其记录在git的数据目录中,然后将目录还原为干净状态。然后你可以git checkout branch2和git stash pop来获取你的更改。
#1
1
Seems like git stash is what you need. git stash
will take your outstanding changes and record them in git's data directory, then revert the directory to a clean state. Then you can git checkout branch2
and git stash pop
to get your changes back.
好像git stash就是你所需要的。 git stash将获取您未完成的更改并将其记录在git的数据目录中,然后将目录还原为干净状态。然后你可以git checkout branch2和git stash pop来获取你的更改。