Jamie Tanna he/him
Chief Blogger @ https://www.jvt.me
89 things I know about Git commits
git reflog
, and it'll save you deleting a repo and work that was recoverablegit reflog
, and you'll be able to save yourself from mistakes that aren't that badgit reflog
to help un-fuck it=ref
!!)git log
as an indication for standup updates is validgit subtree
Various fixes
git notes
) to a previous message to correct assumptionsrew! add support for SBOMs
or sq
, or use git commit --fixup
commitlint
can be useful, but also frustratingfixup
commits and git rebase --autosquash
has been one of the best Git tips I've learnedgit commit -m sq
is probably my most-run commandgit add -p
and git commit -p
are hugely important for atomic commitsgit add -u
or git add .
git add -u
or git add .
git-branchless
and other means to provide a stacked PR setupThanks for having me!
Git has different uses - a collaboration tool, a backup tool, a documentation tool
Git commit messages are excellent
I've never met anyone who likes reading commit messages as much as me
git reflog
No amount of learning fancy tools and commands saves you from horribly messing up every once in a while
Squashing is:
Writing commit messages have helped me pick up on missing test cases, missing documentation or invalid thought processes, as it helps me rewrite why the changes are being made
Commits should be atomic - all the code and tests, and configuration changes should all be in there
Splitting work atomically can be good for improving your reward drive - you can get many more things done
Writing commit messages can take longer than the implementation
The commit message can be an order of magnitude larger than the number of lines changed in a commit
Commits are a point-in-time explanation of the assumptions and the state of the world for the committer. Don't be too hard on them
I don't want to read AI/LLM rewrites of your changes - either write it yourself, or call it Various fixes
Getting all your contributors to invest the same amount of care into the commit history is a losing battle
Do the work up front to make your history atomic
Documentation is rad. Do more of it