git stash exits 0 but no stash created

前端 未结 2 1176
太阳男子
太阳男子 2021-01-22 07:59

I\'ve been advised to avoid git pull --autostash, and instead use:

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


        
2条回答
  •  伪装坚强ぢ
    2021-01-22 08:44

    This answer does not answer how you stash an empty change but it should solve your problem.

    Check if there are pending changes first (see https://stackoverflow.com/a/3879077/3526980)

    $ git alias.pull-autostash '(git diff-index --quiet HEAD -- && git pull --rebase) || (git stash push && git pull --rebase && git stash pop)'
    

提交回复
热议问题