git:结帐时自动存储+弹出

问题描述 投票:0回答:1

如果我做git checkout my-super-branch git告诉我:

error: Your local changes to the following files would be overwritten by checkout:
    somedir/somefile.py
Please, commit your changes or stash them before you can switch branches.
Aborting

有没有一种简单的方法告诉git自动执行stash + pop?

git git-stash
1个回答
1
投票

Git允许Pipelining操作:

git stash && git fetch && git checkout your-branch && git stash apply

当我使用stash时,你的更改仍然在git stash apply

解决冲突(如果有的话)。

如果您希望在上面的呼叫之后从存储中删除您的更改:

git stash drop

否则你可以使用git stash pop

© www.soinside.com 2019 - 2024. All rights reserved.