Git

Last Updated: 7/13/2023

Committing Best Practices

  • Your commits shouldn't be too big or too small.
  • The whole point of committing is to record checkpoints as we go. So if you screw up, we can always go back and recover our code.
  • As you're coding, when you reach a state you want to record then make a commit.
  • Each commit should represent a logically separate chain set. So don't mix things up. For example, if you're fixing a bug, and then you accidentally find a typo in your app, you shouldn't commit both these changes in one commit, you should have two separate commits, one commit for the typo, another one for the bug fix.
  • You should give meaningful commit messages. Because all of these messages are going to show up in history. So if your messages are cryptic, they're not going to be helpful to you or other team members.
  • You past tense for commit messages, e.g. Fixed the bug. Whatever convention you use, make sure that you and other team members stick to it.