Closed wolfwood closed 4 years ago
Still fails if the remote origin
is not pushable; as it is in my case.
Maybe better use:
# Get remote name
a="$(git rev-parse --abbrev-ref HEAD@{u} || echo origin/"$(git rev-parse --abbrev-ref HEAD)")"
remote="${a%%/*}"
remote="${remote:-origin}"
branch="${a#*/}"
branch="${branch:-master}"
git push "$remote" HEAD:"$branch"
Untested, but should do. Using something similar in https://github.com/benbe/git-prompt
looks like git branch --show-current
is sufficient for the branch (though this may be recent syntax?), maybe git remote show
is sufficient for the origin?
Worked for me.
currently paint.sh assumes a branch name of master. if that is not the current branch name, script fails with a somewhat confusing message about an invalid refspec.
this patch #WorksForMe