Ben <ben@xxxxxxxxx> writes: > Hi Phillip, > > The expected behavior: (as per v2.21.0:/git-legacy-rebase.sh:679) > AUTOSTASH=$(git stash create autostash) > git reset --hard > git checkout master > git rebase upstream > git stash apply $AUTOSTASH > > > The actual behavior: > AUTOSTASH=$(git stash create autostash) > git reset --hard master > git checkout master > git rebase upstream > git stash apply $AUTOSTASH > > So, the problem with the actual behavior is the move of the currently active branch with 'git reset --hard master' Your expected and actual behaviour are described above, but it is not mentioned out of what command (and in what settings) you expect the above behaviour. I am guessing that the setup and the command is something along this line? git checkout not-the-master work work work git rebase --autostash upstream master That is, you have checked out a branch that is not the 'master' branch, you have accumulated some work in the working tree, and then you ask "please stash away the work in progress and then rebase the 'master' branch on top of the upstream branch"? If so, my expectation for the third step (i.e. the actual "rebase") aligns with yours. After stashing away the local change, we want to get a clean working tree, checkout the master branch and rebase it on top of the upstream. With the command sequence you wrote in the "actual" section, after stashing away the local change, the current branch that is *not* the master is reset to the tip of 'master', which would not be what we want.