Git Log

git log –stat

Show statistics of number lines added and deleted.


git log –since="3 weeks ago" –until="yesterday"

Show the commits for a time period

git log -p

Show patches of the commits


git log –graph

Prints a graph on the side to show branches


The stars in the graph show which branch the commits are on. The full command for the above output is:

git log --graph --stat --pretty=short

The repository used is the repository of git itself. You can clone the repo yourself with:

git clone git://github.com/gitster/git.git

The repositories used above are from drupal. Clone Drupal-core with:

git clone --branch 7.x http://git.drupal.org/project/drupal.git

Git Show

Show a particular commit with git show

git show HEAD^^^

It will show the entire commit as a diff.

Set git to output color

git config --local color.ui auto

This will add the following to your .gitconfig file:

       ui = auto

Git Bisect

Try to find where in the version history a bug first appeared.

# start bisect
git bisect start
# set good point: there was no bug here, this can be a tag, SHA1, or HEAD~18 ...
git good v1.2.6
# set bad endpoint: we know it had shown up by here
git bad master

# bisect will select a commit half way between good and bad
# test ... then tell git if its good or bad
git bisect good
# it will split the other half in half
git bisect bad
# when you've found the bad commit, reset the branch with
git biset reset