Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 16 lines (11 sloc) 508 Bytes
#!/bin/zsh
# Allow pushing only the current branch to the remote-tracked branch (if there
# is one) without having to manually specify the remote branch and without
# having to globally reconfigure push.current.
local upstream branch
local -a split
upstream=$(git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null)
[[ -n $upstream ]] || exit 1
branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD 2>/dev/null)
split=( ${(s:/:)upstream} )
git push ${split[1]} ${branch}:${split[2]} $*
Something went wrong with that request. Please try again.