我知道如何解决这个问题:
user@host$ git pull
Updating 9386059..6e3ffde
error: Your local changes to the following files would be overwritten by merge:
foo.bar
Please, commit your changes or stash them before you can merge.
Aborting
Run Code Online (Sandbox Code Playgroud)
但是,是不是有办法让git pull做stash和pop舞蹈给我吗?
如果此命令具有不同的名称,则可以.
创建shell别名git stash; git pull; git stash pop是一种解决方案,但我寻找更好的解决方案.
使用时git rebase --autostash,git会自动创建一个"autostash"提交,并在成功重组后重新应用它.
但是如果重定位被中止(例如,:cq当它是交互式rebase时在Vim中使用),autostash-commit可能最终会成为悬空提交.
Git 2.9.0