When working on patch fixes for a specific, tracked issue, our workflow looks like:
1. git checkout patch; git pull upstream patch; # make sure we're up-to-date 2. git checkout -b issue-435-db-integrity-exception 3. # code some awesome 4. git commit -am "Fixes issue #435" 5. git push -u origin issue-435-db-integrity-exception Then we open a pull request from origin/435 to upstream/patch, so that the code review can take place on GitHub/Bitbucket. Then we just start over from step #1.
But, though it may sound a bit whiny, it would be great if we didn't have to explicitly name the remote branch we want to create:
git push -u origin issue-435-db-integrity-exception It's not a lot of fun to type that branch name all over again, and I disagree with changing it to just 435 or something more compact.
Is there a way to (1) force Git to push the current branch to a similarly named branch, creating it if necessary without explicitly naming it? Not globally, just an on-the-spot kind of flag.
Or, is it possible to (2) access the current branch in a Git alias, and write something like:
[alias] pnew = push -u origin $(git symbolic-ref --short HEAD) (But this doesn't work - it thinks that the --short option is meant for push)