Last Updated: February 25, 2016
·
341
· fmaylinch

git log - one commit each line

I use this alias in my .gitconfig to print a simple log with one commit each line:

[alias]
    log1 = log --pretty='format:%h - %an, %ar : %s'

Or if you want it with colors (much clearer):

[alias]
    log1 = log --pretty='format:%C(white)%h%Creset - %C(green)%an%Creset, %C(yellow)%ar%Creset : %C(cyan)%s%Creset'

(Note: see this post about colors: http://stackoverflow.com/a/15458378/1121497)

Then you can type:

git log1

I use that command mostly to see differences between branches. For example, use the following from some branch (e.g. master) before merging another-branch into it, to see which commits would be merged:

git log1 ..another-branch

You can get the same result from another-branch using the next command:

git log1 master..

Using almost the same, check what you are going to push to origin/master from your local master:

git log1 origin/master..