If you are on a branch you can use:
git reset --hard @{1}
There is not only a reference log for HEAD (obtained by git reflog
), there are also reflogs for each branch (obtained by git reflog <branch>
). So, if you are on master
then git reflog master
will list all changes to that branch. You can refer to that changes by master@{1}
, master@{2}
, etc.
git rebase
will usually change HEAD multiple times but the current branch will be updated only once.
@{1}
is simply a shortcut for the current branch, so it's equal to master@{1}
if you are on master
.
git reset --hard ORIG_HEAD
will not work if you used git reset
during an interactive rebase
.