2012-07-30 19 views

回答

8

如果您还没有提交:

$ 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 
1

供将来参考。通常情况下,你会在做任何改变之前分支。但是,以供将来参考

git stash save 
git stash branch <branchname> 
相关问题