A Healthy Everyday Git Commit

GIT stands for God Im Tired because sometimes I encounter some errors when I use this tool and oh boy it’s tiring when you can’t find the answers. But watching GNOME Asia Summit 2021 helped me understand more about it. Git is not just commat commit or pall pull pall pull, there’s more!

Mistake I always do is that I didn’t write the commit message crystal clear. I forgot that I need to make every commit easy to understand by others. Instead of writing ‘add navbar components’, for example, we could write something specific, like ‘wip: add navbar components’. I should’ve added ‘wip’ because this one’s called Git Commit Convention.

And it would be better if we add the issue or ticket number from Jira since most of us use this platform to work as a team. It helps our team to monitor our tasks/tickets.

The more detail git commit, it’s better - Yudhi Satrio

Git Commit Convention

I think most of tutorials miss about this Git Convention (or is it me that left behind hehe). We can use these conventions to make everything clearer. Some of the conventions including:

  • feat: (new feature for user)
  • fix: (bug fix for user, not a fix to build a script)
  • docs: (changes to the doc)
  • style: (it’s all about cosmetics)
  • refactor: (refactoring production code, eg. renaming a variable) Those conventions are also called prefix. Note: it’s okay to customize the prefix as long as our team understands.

Did You Know that You Can Have Fun with Git?

  • Leaderboards command, git shortlog -sn --all --no-merges
  • See What Everyone’s been Up to, git log --all --online --no-merges
  • Gitmoji –yep, that’s emoji on Git

Conclusion

Git is hard, it’s okay. But just like other web dev tools, it’s only matter of time until we master it. I just need to get used to Git. Plus, there’s a better way to write not just clean-code, but clean-commit. Apparently, it’s fun too!