$ git config --global push.default currentto have git create remote branch with the local branch name.
At one time, I configured git to create remote branches with the local branch name so when making a new remote branch is as easy as:
Except I forgot what the configuration was! I (and my colleagues) encountered this situation:
and the usual solution would be:
- take hand off home row
- copy the command:
git push --set-upstream origin testthat git automatically generated (“how convenient!”)
- paste the command
- get my keys onto home row
- press enter
That’s six steps, four if your hand was not on home row to begin with, but manual steps that aren’t really automatable.
When I started looking for what I did to configure
git push -u to
basically automate the above six steps, I could not… it’s
difficult because results focus on just working with remote branches…
The key configuration for git to automate the six steps when pushing a new local branch and have it created on the remote server is:
All this does is push the current branch only. No simple or matching, just the current.
With this configuration, pushing a new local branch to github becomes:
and now I can move my hands off home row (and keep them off!) to open a browser to github to create a pull request. :-)