比如在master下,修改/新建了文件。 此时发现这样的修正需要到另一个分支下进行。 如何将当前工作直接提交到一个新的branch中? 提交后,当前master变成clear工作目录。
巴扎黑2017-04-22 09:01:32
As coder said, just create a new branch and cut to it.
However, if you want to switch to an existing branch, for example, after making changes, you find that you should commit on another existing branch, there may be a conflict when switching over. At this point you need to use the stash function:
git stash
git checkout other_branch
git stash pop
git commit -av # or whatever
PHP中文网2017-04-22 09:01:32
You only need to execute the command to create a branch under the current branch:
git checkout -b newbranch