git tip: define a custom alias

Git provides a really, really powerful set of tools, which my brain can remember the most important ones of. Luckily, you can define alias’ for the commands that are nice to have, but probably a lot longer.

A quick collection of common shortcuts I’ve found in the git cheat sheet on

To add the alias to git, just put them into your .gitconfig file like so:

# my stuff
 log-ago = "log --pretty=format:'%h - %an, %ar : %s'"
 flat = "clone --depth 1"

human readable log date

command: git log --pretty=format:'%h - %an, %ar : %s'

my alias: git log-ago

This shows a pretty, twitter like summary of the most recent activity on your repository, which is great when you want to catch up on activity in busy times.

an example output of this command is:

8544ef8 - Mark Otto, 21 hours ago : Merge pull request #7874 from burnsra/3.0.0-wip-form-examples
da9cf10 - Robert Burns, 21 hours ago : Fix glyphicon in "Dropdown in a button group" example
5ebd6a4 - Mark Otto, 22 hours ago : Merge pull request #7872 from burnsra/3.0.0-wip-caret
a38a342 - Robert Burns, 23 hours ago : Fix caret position
8ae6256 - Mark Otto, 28 hours ago : Merge pull request #7866 from marsuboss/patch-3
4eeebe7 - marsuboss, 34 hours ago : Fix
37898d5 - Mark Otto, 2 days ago : Merge branch '3.0.0-wip' of into 3.0.0-wip
2c6e854 - Mark Otto, 2 days ago : fix broken responsive utilities table
dd7bb71 - Mark Otto, 2 days ago : spacing

(taken from the upcoming release of twitter bootstrap in this case)

As you can see, this command shows contributions to the current branch in a human readable format and of course shows details like the commit hash and the author of the respective commit.

Leave a Reply

Your email address will not be published. Required fields are marked *