git: disable automatic pushing to a certain remote branch

跟風遠走 提交于 2019-12-05 01:57:48

Perhaps the simplest answer is to rename your local branch some_branch to another name, e.g. with:

git branch -m some_branch a_branch_name_not_present_on_some_remote

The reason for this is that git push by default pushes each branch to a branch with a matching name on the remote, if such a branch exists there. If you don't like this behaviour in general, you have to change the push.default config option. For example, you could do:

git config --global push.default tracking
git branch --set-upstream some_branch origin/totally_different_branch

I wrote a bit more here about the behaviour of git push where you don't specify the refspec explicitly.

Easy way - edit it out of your .git/config file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!