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.
With the release of git 2.37 in June 2022, you can do so with push.autoSetupRemote
git config --global push.autoSetupRemote true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With