Git aliases we use at Deveo

Git aliases we use at Deveo

Regardless of the fact that Deveo supports Git, Subversion and Mercurial version control systems, we use Git for our development. Our goal is to make development teams more efficient with our development platform, and thus, we constantly improve how we develop software ourselves. One enhancement to software developer's daily workflow is the proper use of version control systems. When a developer begins to master a version control system, such as Git, he can fine tune the process with the use of aliases. With Git aliases, you can avoid typing the same commands over and over again. Aliases were added in Git version 1.4.0.

For this blog post, I asked our developers to show and tell what's in their .git/config [aliases] section. I'm going to cover the aliases and key points the discussion introduced below.

Git aliases

Most of the developers have pretty common and basic stuff in their aliases. Basically writing st is faster than status, similarly as writing co is faster than checkout, and so on. Most of our team likes to use aliases only for local actions and to be a bit more cautious when doing remote actions. push, pull and fetch happen, or at least, should happen pretty rarely compared to local actions, which makes adding three to four characters after spending five hours in implementation not that big of a deal. The most common set of aliases is listed below:

alias.st=status  
alias.ci=commit  
alias.co=checkout  
alias.df=diff  
alias.dfc=diff --cached  
alias.cia=commit --amend  
alias.b=branch  
alias.t=tag  

Bash aliases

Our Lead developer JP told he is too lazy to use Git aliases. However, he had configured bash aliases to shorten the commands even further. The aliases themselves are used for the exact same local actions such as showing the status and diffing. The following snippet can be found from his .bashrc:

alias gs='git status'  
alias gd='git diff'  
alias gdc='git diff --cached'  
alias gl='git log --graph --oneline --decorate --date=relative --all'  

There were also some not that commonly used aliases related to temporarily ignoring files and well as even more fine-tuned logging.

ignore = !git update-index --assume-unchanged  
unignore = !git update-index --no-assume-unchanged  
ignored = !git ls-files -v | grep ^[a-z]  
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short  

A common opinion among our Development team was that sometimes too fancy aliases can hurt. Even though Deveo itself offers security mechanisms such as protected branch, there can be nasty surprises when you don't know what you’re really doing, especially with the remote commands.

Conclusion

One of the Deveo core values is simplicity. The usage of Git aliases among our developers reflects this value pretty well, as most of our developers only use simple aliases for local actions, such as getting the status or diff by typing fewer characters.

What aliases are in your .git/config? What do you find the most useful? Share your favourite aliases below.

Seamless software development.

Code management and collaboration platform with Git, Subversion, and Mercurial.

Sign up for free
comments powered by Disqus