Skip to content

Instantly share code, notes, and snippets.

@hexium310
Created September 30, 2021 06:43
Show Gist options
  • Save hexium310/f5dfd8b699ffab0233b194c905a02ce0 to your computer and use it in GitHub Desktop.
Save hexium310/f5dfd8b699ffab0233b194c905a02ce0 to your computer and use it in GitHub Desktop.
Use `HEAD` in `git pull`, `git rebase` and so on
autoload -Uz add-zsh-hook
__set_head() {
if git rev-parse --show-toplevel > /dev/null 2>&1; then
alias -g HEAD=$(git symbolic-ref --short \HEAD)
fi
}
__set_head
add-zsh-hook chpwd __set_head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment