Git commits and personal projects
Today is the day I start treating the git commits of my personal projects with the respect they deserve. I've read it too many times: something about how you don't really have to have good commit practices for your personal projects because you are the only one who sees them or something like that. That is what I've told myself for years as I haphazardly stage and throw commits together. But that changes today! Using this article on dev and this blog post as my guide from now I'm going to try to keep a clean git commit history. Here we go!
git commit convention from the dev article linked above
<type>(<optional scope>): <subject> <optional body> <optional footer>
some ideas for types: feat, fix, docs, build, perf, refactor, style, test
some ideas for scope: client, server, mobile, core
edit: During my time at The Collab Lab my team and I have been using a simple
FIX:, etc messaging system and it seems simple and clean for small projects. Larger teams working professionally will most likely have a style they prefer, but the simple system should work well for personal projects.
again checkout the dev post above for more ideas on this.
a few little git tidbits that I have found helpful:
git merge --squash features_branchfor when you have made lots of little commits to a single conceptual feature
git commit --amend --no-edit --date=nowto add more things to your last commit, but with no change of message
git commit --amendwill allow you to update your message as well.
- don't push changes to main branch casually (this has historically been a big issue for me, which is why I need to always be working on a dev / feature branch.)
git log --oneline --abbrev-commit --all --graph --decorate
git log --graph --decorate --allmy two favorite git log flags combos
- I've also found that simply looking at the ohmyzsh git plugin implementation yields lots of interesting things to think about. github link