Git Aliases
Once you start developing some experience with using git on the command line, you will sometimes find yourself typing some long commands over and over again. You can create aliases in git that are very similar to the bash alias shortcuts you use in the shell.
Steps to do this are highlighted in chapter 2.7 of the Git Book authored by Scott Chacon and Ben Straub and published by Apress.
One of the commands that I use a lot is:
$ git log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local
which provides a nice colorized listing of the project’s activity and looks something like this:
* 2f6cc07 (HEAD -> automation, origin/master, origin/HEAD, master) Updated merge for README.md
|\
| * 84e20c2 Initial commit
* 8dc456f Completed migration for github site.
* bf67601 fixed head before sed
* 89780c3 Merge pull request #124 from thalios1973/feat/pandoc-test-fix
|\
| * c9a297c Added additional check that will allow the use of pandoc without the --strict flag or 'hsmarkdown' hack.
* | 025cf79 Merge pull request #125 from thalios1973/feat/body-end-file
|\ \
| |/
|/|
| * 272b1b6 Added ability to include custom code just before the </body> tag. body_end_file global config variable added.
|/
* 9f66ad0 README formatting
* 500253e Support for static, not managed by bashblog html files. Close #92
* 3c73ef6 Deleted the now defunct Twitter JSON API for share count. Fix #117
* b5a4590 bump version to 2.8
* 5c8e0e5 Revert changes in #116
* 5fc037f Merge branch 'master' of github.com:cfenollosa/bashblog
|\
| * c6a9bef Revert tag management from #116
| * 6222672 Better error message for $EDITOR. Close #112
| * 36d79b5 support Markdown.pl in bashblog folder. Close #113
| * 7154c07 Merge pull request #116 from McDutchie/master
| |\
| | * f50a17c tags_in_post(): bugfix for non-GNU 'sed'
| | * 2a29b22 Fix renaming using 'bb.sh edit -n'. Suppress 'which' errmsg.
| | * 62a26bb Merge remote-tracking branch 'upstream/master' Resolve minor editing 2.6-to-2.7 editing conflict in bb.sh
| | |\
| | * | 54cc0c8 More code refactoring. Limit word splitting and disable globbing by default.
| | * | d1a84d6 Merge remote-tracking branch 'upstream/master'
| | |\ \
| | * | | a674ec5 rebuild_tags(): use array for more robust file handling
| * | | | 2157b92 Slavic language support, thanks to Tomasz Jadowski
| | |_|/
| |/| |
but nicer than this website can depict (for now).
Rather than typing this long command every time, I just create an alias:
$ git config --global alias.lola 'log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local'
Then all I need to type from now on is:
$ git lola