Why would I want to see a log of past commits?


When would git log's output come in handy?


The output seen when running git log is the 40-character SHA, the author of that commit, the date and time of the commit, and the commit message.

This is super helpful when you need to look back over the history of a piece of code for various reasons.

  1. What if you broke something in the code and wanted to see what past, working commits you have available to revert to?
  2. What if you want to make a new feature based on an older version of your code, but didn’t remember which commit you wanted to base it off of?
  3. It’s good to know this information is there so that when you’re developing, you have the peace of mind knowing that, as long as your commit messages were decent, you’ll have a safety net.

And that’s really the main issue: bad commit messages. If you don’t write commits that concisely tell what happened in a commit, it won’t be of much use later when you run into trouble.