Git - One Line Log Messages
03 Mar 2014A lot of the time when viewing the log in your Git repository you aren’t that interested in the author and date/time of each commit - the message and the hash are the most important parts. It would therefore be helpful to cut out everything from the log apart from the main details of each commit. Luckily, just like most things in Git, this is pretty straightforward to do:
git log --pretty=oneline
Which will output something like:
a4cc7fe68b3a9f9fe4b1927aa687714ca05a5096 Third commit
246387bc6f15b1ca4a384af362cdb0deb8364b0e Second commit
1c827a75295fe5ad657fd3882cbb3a32c3ca1b2b Initial commit
This is all well and good, yet the hash is pretty long and distracted. Again however there is a way around that as well:
git log --pretty=oneline --abbrev-commit
Which outputs:
a4cc7fe Third commit
246387b Second commit
1c827a7 Initial commit
This time we only get a fraction of the hash for each commit (which is all we really need) and the message - much better!