Exit status is 0 but autostash requires manual merging

后端 未结 2 1324
北荒
北荒 2021-01-14 22:35

When I do:

git pull --rebase --autostash

Sometimes I get a message that there was a conflict applying the stash and I\'ll need to merge it

2条回答
  •  耶瑟儿~
    2021-01-14 23:25

    With non-zero exit code you cannot distinguish pull error from stash pop error.

    My advice is to avoid autostash. It seems convenient when it works but is problematic when it doesn't. And if you do things like

    git stash push
    git pull --rebase
    git stash pop
    

    you can create a bash script or a git alias:

    git alias.pull-autostash '!git stash push && git pull --rebase && git stash pop'
    

    Usage:

    git pull-autostash
    

提交回复
热议问题