Skip to content

Instantly share code, notes, and snippets.

@pglezen
Last active December 31, 2015 19:39
Show Gist options
  • Save pglezen/8034464 to your computer and use it in GitHub Desktop.
Save pglezen/8034464 to your computer and use it in GitHub Desktop.
A few useful log aliases for Git.

This is a list of Git aliases that are really handy for me.

logdate

This alias logdate will list entries, one per line.

git config --global alias.logdate "log --pretty=format:'%h %cd [%an] %s' --graph --date=short"

By itself, it will list all commits for the repository. So you usually want to add a limiting parameter. So see only the last five entries:

git logdate -5

logweek

This alias logweek will list all commits from the past week.

git config --global alias.logweek "log --pretty=format:'%h %cd [%an] %s' --graph --date=short --since=1.week"

This one does not need to be augmented often. One case is displaying the commit history for the current directory.

git logweek .
* 92f86cd 2015-12-04 [Paul Glezen] Initial commit.

logday

For those really busy days, the logday alias shows all the commits in the last 24 hours.

git config --global alias.logday "log --pretty=format:'%h %cd [%an] %s' --graph --date=relative --since=1.day"

Since the usual date format is superfluous, it provides more detail on the time.

git logday
* 92f86cd 5 hours ago [Paul Glezen] Initial commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment