automatically create --set-upstream origin doing git push
It's annoying I got prompt every time trying to push new branch. For instance, I do this
git checkout -b myBranch
git add . && git commit -m 'first commit'
git push
but I got this
git push --set-upstream origin myBranch
is there anyway to skip this?
You can configure Git with these settings:
git config --global push.default current
git config --global remote.pushDefault origin
and then you can simply use:
git push
to push the curent branch to a branch with the same name on the remote origin
. This does not set the upstream configuration, but it does allow you to push without any other arguments, whether it’s the first time you are pushing a branch or not.