Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I configure git to default push my current branch to the origin? [duplicate]

Tags:

git

Is there a way to configure git to default push my current branch to the origin?

E.g., I want to do:

git push origin

And have it push whatever branch I've currently checked out to the upstream origin.

like image 493
MrDuk Avatar asked Dec 28 '25 11:12

MrDuk


1 Answers

Set push.default to tracking.

$ git config --global push.default tracking

Now git push pushes only the branch you're currently on, assume an upstream branch has been configured (see git branch --set-upstream).

like image 177
meagar Avatar answered Dec 31 '25 08:12

meagar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!