Sunday, November 25, 2012

Checking user specific commits in GIT


> To filter your commit history to only the ones done by a specific author.

           git log --author=kondal.kolipaka@kony.com

 > -[number] option, which will limit the results to the last [number] commits.

         git log --author=kondal.kolipaka@kony.com  -4

> git log --since --before filter commits by date committed

If you want to specify a date range that you're interested in filtering your commits down to, you can use a number of options - I use --since and --before, but you can also use --until and --after. For example, if I wanted to see all the commits in the Git project before 3 weeks ago but after April 18th, I could run this (I'm also going to use --no-merges to remove merge commits):

     git log --oneline --before={3.weeks.ago} --after={2012-11-18} --no-merges

> git log --grep filter commits by commit message
You may also want to look for commits with a certain phrase in the commit message. You can use --grep for that. Let's say I knew there was a commit that dealt with using the P4EDITOR environment variable and I wanted to remember what that change looked like - I could find the commit with --grep.

    git log --grep=P4EDITOR --no-merges

No comments:

Post a Comment