Push current branch only
When using tracking branches, You can push only the current branch you are on rather then all branches you have. This is a more sensible setting for me.
git config --global push.default tracking
git checkout -t origin/test
echo foo > test && git commit -am "Test"
git push # pushes test to origin/test
If you have an existing branch with no upstream set, push once like this:
git push -u origin branch
This becomes especially useful when you have different branch names locally and remotely. In my company, our branch names are like:
group/username/topic
Locally, I just use topic as my branch. Without this setting, my push command every time would be:
git push origin topic:group/username/topic
Written by William Cahill-Manley
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#