Set default push branch name

Git, Configuration, Branch · Jun 30, 2021

Use the name of the current branch when pushing by default as the name of the remote branch.

  • Use git config push.default current to set the name of the remote branch to the one of the current local branch as the default.
  • You can use the --global flag to configure this option globally.
git config [--global] push.default current
git config --global push.default current

git checkout -b my-branch
git push -u
# Pushes to origin/my-branch

Written by Angelos Chalaris

I'm Angelos Chalaris, a JavaScript software engineer, based in Athens, Greece. The best snippets from my coding adventures are published here to help others learn to code.

If you want to keep in touch, follow me on GitHub or Twitter.

More like this