DEV Community

Discussion on: 8 underrated git commands every programmer should know (not the usual pull, push, add, commit)

Collapse
chaelcodes profile image
Rachael Wright-Munn

2 & 3 - it's better to get comfortable with HEAD~1, because you can HEAD~2. If you only learn HEAD^, then you only learn to go back 1 commit.

5 works post-rebase. git log does not.

Collapse
dentych profile image
Dennis • Edited on

You can do HEAD^^^^^ to go back 5 commits, so in reality it's the same. I find it easier to write ^, but it's really up to personal preference :)

5 works fine post-rebase. git reflog can be very confusing for newbies, because it shows a log of where the HEAD has moved, and not just a (probably) fairly linear commit history.