Quick Notes On Git Amending, Squashing & Diffing

3/25/2024

I've been working collaboratively on Drivetracks with a couple people and have forced to improve my git-fu a bit and want to jot down real quick what I've learned.

descriptiongit command
change last commit messagegit commit --amend
change specific commit messagegit rebase -i HEAD~3
add stuff to the last commitgit commit --amend --no-edit
sqash last n commitsgit reset --soft HEAD~n
interactive squashgit rebase -i HEAD~n
(...but keep original commit date)git rebase -i --committer-date-is-author-date HEAD~n
see a branch's changesgit diff main
see a branch's divergent changesgit diff main...branch
see diff between two commitsgit diff hash1...hash2