3
我克隆了存储库的主分支并进行了一些更改。如何使用这些更改创建分支?我不想推动他们中的任何人去掌握。使用现有更改创建新分支
我克隆了存储库的主分支并进行了一些更改。如何使用这些更改创建分支?我不想推动他们中的任何人去掌握。使用现有更改创建新分支
如果您还没有提交:
$ git checkout -b <new_branch_name> # create (and checkout) the new branch
$ git commit -a # commit to the new branch
如果您已经承诺(master
包含更改):
$ git branch <new_branch_name> # create the new branch
$ git reset --hard HEAD^ # rewind master
$ git checkout <new_branch_name> # switch to the new branch
供将来参考。通常情况下,你会在做任何改变之前分支。但是,以供将来参考
git stash save
git stash branch <branchname>
你犯了吗? – vergenzt 2012-07-30 16:40:14