46.1. Using an alias
An alias in Git allows you to create a short form of one or several existing Git commands. For example, you can define an alias which is a short form of your own favorite commands or you can combine several commands with an alias.
46.2. Alias examples
The following defines an alias to see the staged changes with the new
git staged
command.git config --global alias.staged 'diff --cached'
Or you can define an alias for a detailed
git log
command. The following command defines the git ll
alias.git config --global alias.ll 'log --graph --oneline --decorate --all'
You can also run external commands. In this case you start the alias definition with a
!
character. For example, the following defines the git ac
command which combines git add . -A
and git commit
commands.# define alias
git config --global alias.act '!git add . -A && git commit'
# to use it
git act -m "message"
0 comments:
Post a Comment