Some useful shortcuts I use with oh-my-zsh git plugin.
Alias | Command | Notes |
---|---|---|
gb |
git branch |
List of local branches |
gba |
git branch -a |
List of local and remote branches |
gcam |
git commit -am |
Add all files to stage and commit |
gcmsg |
git commit -m |
Git commit message |
gco |
git checkout |
Change branch |
gco - |
git checkout to the previous branch |
Change branch to the previous one |
gd |
git diff |
Files differences in staging |
gfa |
git fetch --all --prune |
Fetch all remote branches, delete branch if upstream is gone |
gl |
git pull |
Pull from remote |
gp |
git push |
Push to remote |
gpsup |
git push --set-upstream origin [currentbranch] |
Set upstream branch |
gst |
git status |
Local files to commit |
Add your zsh aliases
- Open zsh configuration file
nano ~/.zshrc
- Add aliases using the syntax
alias [name]='[command]'
For instance, these are my aliases in .zshrc
file
alias gflbs='git flow bugfix start'
alias gflbf='git flow bugfix finish'
alias gbm='git branch -m'
alias gbD='git branch -D'
alias gbuu='git branch --unset-upstream'
To apply these changes, you should close the tab and open a new one or you can run
source ~/.zshrc
or shorter version
. ~/.zshrc
My aliases
Here are some shortcuts I added compared to the ones came with oh-my-zsh plugin
Alias | Command | Notes |
---|---|---|
gflbs |
git flow bugfix start |
Start a bugfix/ branch from develop
|
gflbf |
git flow bugfix finish |
Finish a bugfix/ branch from develop
|
gbm |
git branch -m |
Rename branch |
gbD |
git branch -D |
Delete local branch with force option |
gbuu |
git branch --unset-upstream |
Unset upstream branch |
π More info
Top comments (2)
this also might help
ohmycheatsheet.com/oh-my-zsh-comma...
That's really helpful, I found commands I did not know about! Thanks π