What is the point of using a git alias?

Consider the following:

$ git config --global alias.show-graph 'log --graph --abbrev-commit --pretty=oneline' 

Now, by typing git show-graph , run the log command shown above.

Question: Why not just use a bash script for this? Are there any advantages or disadvantages to this?

+6
source share
3 answers

If you are used to typing git SOMETHING , then using the git alias function works more conveniently. What about that.

+5
source

One possible advantage is that sometimes when you integrate git with other tools, these tools can use git aliases.

For example, a hidden plugin for vim allows you to execute arbitrary git commands with :Git <command> - so you can use git aliases - you wouldn’t use, t use a standard alias or bash script in the same context.

+5
source

Some people use their dotfiles for use on different systems. Then you will have access to git aliases wherever you deploy your favorite ~/.gitconfig

The same applies to bash aliases in favor of bash scripts. But I would rather use git alias than alias , and thus save the git related configuration separately in .gitconfig .

+1
source

All Articles