Git log is a pretty powerful tool if you want to look back and see your or somebody elses work. If you combine this tool with Unix command line tools such as pipes and xargs you can come up with some pretty powerful tools for searching the history.
Finding all the contributors
Say you wanted to see all of the authors for a given git repo, you could use git log and pipe it to
sort and then
Exercise: Ruby contributors
From the command line clone the ruby git repo into a local directory and cd in to the folder. Now run:
To give you a list of unique contributors to the project.
Now we want to count the total number of contributors, just add in
Searching the repo
If you want to search a git repo for an instance of something that you or a specific person has changed, you can do so with a simple command as follows:
Say I want to see the diff’s for each commit that the command above returned, we can do this with unix pipes like so:
Now, say I want to see all that match data but with the match highlighted, I can use a tool like
Or, say that I want to edit the output in a file, I can even pipe it to Vim!