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 ADD:, 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:

  1. git merge --squash features_branch for when you have made lots of little commits to a single conceptual feature
  2. git commit --amend --no-edit --date=now to add more things to your last commit, but with no change of message
  3. git commit --amend will allow you to update your message as well.
  4. 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.)
  5. git log --oneline --abbrev-commit --all --graph --decorate
  6. git log --graph --decorate --all my two favorite git log flags combos
  7. I've also found that simply looking at the ohmyzsh git plugin implementation yields lots of interesting things to think about. github link