Git‎ > ‎

Aliases

Git allows you to make "aliases", which are shortened commands.  For instance, you might want to quickly figure out what commits you have in the master branch of your repository but have not yet been pushed to origin, in a brief report.  You're preferred method for this would be git log --pretty=oneline origin/master..master but that gets really boring if you type it over and over.  You can add this to your aliases with a command ...

git config alias.unpushed "log --pretty=oneline origin/master..master"

... or you can edit a config file (~/.gitconfig or .git/config in a repository) and add a section like this ...

[alias]
    unpushed=log --pretty=oneline origin/master..master

... and now you can type git unpushed from the command line to see what hasn't yet been pushed to origin and this shorter command does exactly what the long one does.  You can also change oneline to short, medium, full, and other formats.  See man git-log for many other options and determine which format looks best for you.
Comments