简体   繁体   中英

How to push to a specific branch on bitbucket using git

I understand that the command

git push <url>

is what you're supposed to use to push but as I understand it that just pushes to the master branch. How do I push to different branches on this project. Can someone explain how this works because I don't understand it?

You can specify the name of the branch along with the command. Like,

git push origin your_branch

It will push your_branch branch in your local system to your_branch in the remote machine. But if you want to push a branch called your_local_branch to a remote branch named your_remote_branch , then you should type -

git push origin your_remote_branch:your_local_branch .

git checkout -b branch1

creates & checks out a branch branch1

do your work, git add , git commit etc

git push origin branch1 pushes to the branch called branch1

Best quick guide is here http://rogerdudler.github.io/git-guide/

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