Created
March 13, 2023 15:23
-
-
Save camerond/f9701b48a4f18ea0513fe2deb2fdac22 to your computer and use it in GitHub Desktop.
git 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
# from https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/git.zsh | |
function git_current_branch() { | |
local ref | |
ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2> /dev/null) | |
local ret=$? | |
if [[ $ret != 0 ]]; then | |
[[ $ret == 128 ]] && return # no git repo. | |
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return | |
fi | |
echo ${ref#refs/heads/} | |
} | |
alias vim='nvim' | |
alias gst="git status" | |
alias gd="git diff" | |
alias gup="git pull --rebase" | |
alias gco="git checkout" | |
alias gp="git push" | |
alias gpsup='git push --set-upstream origin $(git_current_branch)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment