Git me the log

There are times that as a developer who primarily responsible for the deployment can use a little helping hand on getting the right source and builds for a release. After all, the artefacts coming out of it can be the same one that’s going to be deployed in production. It’s really important that we check each and every code commits as well as their impacts.

One thing I do in this situation is I use the git log to give me the information of the sources and commits that will be part of the release:

git log --pretty=format:"%h - %an, %ar, %ae : %s" --stat --name-only --graph --since=2015-01-01 >> logme.log

Let’s run this down bit by bit

git log is a git command that gets the details of the commits
--pretty=format can be used to specify a specific format using "%an, %ar, %ae, : %s". Thats author revision, name, email and file.
--stat to show the statistics
--name-only to show the filenames only
-- graph to show a graphical representation
--since to show only the commits made from the given date up to the current date (today)

16-07-2015 8-34-13 AM

How about a graph only? I ran the same git log but only passed a format and a –graph argument. Output below.

$ git log --pretty=format:"%h %s" --graph
* 2d3acf9 ignore errors from SIGCHLD on trap
* 5e3ee11 Merge branch 'master' of git://
| * 420eac9 Added a method for getting the current details to the branch.
* | 30e367c timeouts
* | 5a09431 add timeout protection to hubbys
* | e1193f8 support for heads with slashes in them
* d6016bc require time for xmlschema
* 11d191e Merge branch 'hubbys' into local

.. and how about log specifically for areyes since January 01, 2014 but before November 01, 2010

$ git log --pretty="%h - %s" --author=areyes1--since="2014-10-01" --before="2010-11-01"
5610e3b - Fix testcase failure when extended attributes are in use
acd3b9e - Enhance hold_lock_file_for_{update,append}() API
f563754 - demonstrate breakage of detached checkout with symbolic link HEAD
d1a43f2 - reset --hard/read-tree --reset -u: remove unmerged new paths
51a94af - Fix "checkout --track -b newbranch" on detached HEAD
b0ad11e - pull: allow "git pull origin $something:$current_branch" into an unborn branch

There’s a lot of format options available for git log that can be found here and given these, a lot of automations can be created!

Idea: You can echo this to a file and send it out to developers for verification, or a better idea, loop through the list of users, get each of their emails and revisions, generate the logfile for each and send it out to them. Pretty neat as it will give the developer a bird eye view of their sources that will be included on the release (and notify the team if theirs was not included)