Last active
December 14, 2021 01:39
-
-
Save zbicin/69d9a70b22207e55b296efd9a7da7a53 to your computer and use it in GitHub Desktop.
Git Bash aliases
This file contains 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
# If __git_complete command is not found on Linux, you might need to add this line first: | |
# [ -f /usr/share/bash-completion/completions/git ] && . /usr/share/bash-completion/completions/git | |
# Source: https://stackoverflow.com/questions/9869227/git-autocomplete-in-bash-aliases#comment104140198_47496210 | |
# | |
# Git Push/Pull | |
alias gps='git push'; | |
__git_complete gps _git_push_ | |
alias gpl='git pull'; | |
__git_complete gpl _git_pull | |
# Git Fetch/Checkout | |
alias gf='git fetch'; | |
__git_complete gf _git_fetch | |
alias gch='git checkout'; | |
__git_complete gch _git_checkout | |
alias gfch='git fetch && git checkout'; | |
__git_complete gfch _git_checkout | |
function gchp { git checkout $1; git pull; }; | |
__git_complete gchp _git_checkout | |
function gchpch { git checkout $1; git pull; git checkout -; }; | |
__git_complete gchpch _git_checkout | |
# Git Stash | |
alias gstash='git stash save'; | |
alias gpop='git stash pop'; | |
# Other Git aliases | |
alias gbfind='git branch --list -a | grep'; | |
alias gshitiforgotthisone='git commit --amend --no-edit'; | |
alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment