3 ms·
You can also use git-reflog to restore the branch back to the state it was before the merge. So instead of creating a temporary branch, you can inspect the refl
by altonen 5y ago
You can also use git-reflog to restore the branch back to the state it was before the merge. So instead of creating a temporary branch, you can inspect the reflog, find the entry before the merge commit and do git reset --hard HEAD@{X}.
- balefrost 5y agoThat's true! I personally prefer having a symbolic name for my backup, but the reflog is also very useful for "oops" moments.
- zelphirkalt 5y agoAfaik git branches are merely pointers to commits, so it makes sense, that one can go back finding the correct commit id.
- 5e92cb50239222b 5y agoreflog saved me a few times, just remember that commits not referenced by a pointer (like HEAD or branch) can be GCed and disappear at any point. They are likely to be there right after a merge/rebase is finished, but may not be there anymore an hour later.