Using bash_aliases with git

In Linux distributions where you use the Bash shell, the .bashrc file is a shell script that runs when Bash starts an interactive session. It serves to make the Bash environment for useful for your needs. Most of the time, I have the Ubuntu default .bashrc, which you can restore from /etc/skel/.bashrc if needed, to meet my needs. One of the commands in this file is to process a .bash_aliases file if it exists. This strikes me as a good place to put those long commands that can be easily backed up to Dropbox, evernote entry, etc. What’s an example of a good command? Those command line (cli) git commands with a number of different switches. I can’t ever remember them all, but maybe you can. One of those is to generate an easy to read git graph on the command line:

git log –graph –abbrev-commit –decorate –date=relative –all

or in an alias file, something like:

alias gitgraph=’git log –graph –abbrev-commit –decorate –date=relative –all’

Could you put this in a .gitconfig file? Sure, but I think the syntax can be harder to read, even if it is more portable.


Leave a Reply