Last active
July 4, 2018 10:49
-
-
Save manuelgeek/f7bac9b98c8ce83571d656c18412c30e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I was just watching a friend of mine work with git, and he'd always type all the git commands in full, like git status and git push. I realized that he must not be the only one to do so, so I decided to write this quick blog post and encourage everyone to create Huffman coded aliases for the most commonly used commands. Instead of typing git status, alias it to gs. Instead of git add, alias it to ga, etc. | |
Here are a bunch of aliases that I created for 99% of git commands I ever use: | |
alias ga='git add' | |
alias gp='git push' | |
alias gl='git log' | |
alias gs='git status' | |
alias gd='git diff' | |
alias gdc='git diff --cached' | |
alias gm='git commit -m' | |
alias gma='git commit -am' | |
alias gb='git branch' | |
alias gc='git checkout' | |
alias gra='git remote add' | |
alias grr='git remote rm' | |
alias gpu='git pull' | |
alias gcl='git clone' | |
Here is my typical workflow with these command: | |
$ vim file.c | |
$ gd # git diff | |
$ ga file.c # git add file.c | |
$ gm "added feature x" # git commit -m "added feature x" | |
$ ... | |
$ gp # git push | |
Short and sweet! | |
3 | |
down vote | |
In ubuntu alias get stored in the .bashrc file. | |
If you are typing alias update_linux='sudo apt-get update' in the terminal, then it will create an alias temporarily. It works until you close your terminal. | |
To add an alias permanently you can edit ~/.bashrc and add the alias to it: | |
gedit ~/.bashrc | |
and add alias at the end | |
alias update_linux='sudo apt-get update' | |
Don't forget to refresh the .bashrc configuration, by running: | |
source ~/.bashrc | |
for more details on creating alias you can read following blog: Codebucket.http://codebucket.co.in/create-an-alias-for-terminal-commands-linux/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment