简体   繁体   中英

how to push to develop branch not master?

Whenever I trying pushing with the following command the pull request that will be created will always be targeted at master branch

git push origin my_sample_branch

I already tried setting my upstream with

git push --set-upstream origin develop

but I still push to master branch. how come?

Try it with this command-syntax :

git push <remote> <local_branch>:<remote_branch_name>

In your example like:

git push origin my_sample_branch:develop

Execute the following command:
1.switch branch first
git switch my_sample_branch
2.set the upstream branch
git branch -u origin/develop
3. push directly, it will push to the upstream branch automatically
git push

By the way, you can check the upstream branch by command git branch -vv

Try this:

git push origin your_local_branch : your_remote_branch

Worked for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM