Home > Software design >  Difference between git config push.default and git push origin HEAD
Difference between git config push.default and git push origin HEAD

Time:11-10

I have read about how we can configure our git push to push to the current branch we are in using 1.

git config push.default current

but I also read about how you can push to your remote branch (to have the same name as your local branch) using 2.

git push origin HEAD

When do you use 1 and when do you use 2?

CodePudding user response:

If you set git config push.default current, then you can later just do git push. When you do git push origin HEAD, you are explicitly pushing to the HEAD commit to the origin remote.

p.s. You should use a branch name instead of HEAD.

  • Related