Skip to content

Instantly share code, notes, and snippets.

@bhavika
Created January 16, 2024 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhavika/5e9640a7679e3594a2a297606688e4c4 to your computer and use it in GitHub Desktop.
Save bhavika/5e9640a7679e3594a2a297606688e4c4 to your computer and use it in GitHub Desktop.
ZSH Profile
git_current_branch () {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]
then
[[ $ret == 128 ]] && return
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
}
alias gs="git status"
alias gp="git pull"
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