简体   繁体   中英

Push local commits on master branch to new remote branch

I have local commits on the master branch, but (due to unforeseen external reasons) I now can't push my changes to master and instead need to push them to a new remote branch (that can be merged back to master later).

How do I (safely) do that?

Create a new branch:

git checkout -b myNewBranch

Push to repo:

git push

最简单的方法是,不像之前的答案中所述创建新的本地分支,那就是:假设您位于分支test本地,并希望将其推送到一个名为test-remote的新分支。

$ git push origin test:test-remote

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