简体   繁体   中英

Can I use git push origin master:myBranch to push code I modified in master branch to my branch?

Can I use git push origin master:myBranch to push code I modified in master branch to my branch? Will this affect the master branch?

You can, and that won't affect your local or remote master branch.

But it is better to create myBranch locally (from your current master ) and push it to its remote tracking equivalent:

git switch -c myBranch
git push -u origin myBranch

Next time you are committing on myBranch , a simple git push will be enough to push the local myBranch to the remote myBranch .

What I did is checkout to myBranch and do a "git merge master", which merge the up to date master to my branch, and then do git commit and git push to push the code

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