7
I would like to know the commands to create an alias, I learned that I can shorten my commands and make it faster and more productive, but I still don’t know how to do this. Does anyone know the commands to create and remove?
7
I would like to know the commands to create an alias, I learned that I can shorten my commands and make it faster and more productive, but I still don’t know how to do this. Does anyone know the commands to create and remove?
10
You can add them to your own ~/.gitconfig
:
[alias]
st = status
ci = commit -v
Or you can make use of the command alias
git config:
$ git config --global alias.st status
$ git config --global alias.ci 'commit -v'
More information can be seen on documentation (English).
Reply credits for @Diego Dias on SOEN in this answer.
3
I will assume that you work in Linux or OSX environment.
These aliases you put in your file ~/.bashrc
(in the case of Linux) or in the file ~/.bash_profile
(in the case of OSX). Edit them in Vim (no need to sudo
) and put some aliases like:
alias gs='git status;'
alias gc='git commit $1;'
alias gca='git commit -am $1;'
alias gcap='git commit -am $1; git push;'
(only one detail: use =
and not =
with spaces around it as this is a comparison operator)
Anyway, these are some of the commands I configure for my environment. You can create the commands you want for your case.
Ah! Don’t forget to give one source ~/.bashtrc
(or source ~/.bash_profile
in the case of OSX) to load the commands after you insert them. However, whenever you restart the system, the commands will already be available.
Browser other questions tagged git
You are not signed in. Login or sign up in order to post.