git - 如何将当前修正内容commit到一个新的branch?
ringa_lee
ringa_lee 2017-04-22 08:59:32
0
3
821

比如在master下,修改/新建了文件。 此时发现这样的修正需要到另一个分支下进行。 如何将当前工作直接提交到一个新的branch中? 提交后,当前master变成clear工作目录。

ringa_lee
ringa_lee

ringa_lee

reply all(3)
巴扎黑

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
洪涛

You only need to execute the command to create a branch under the current branch:

git checkout -b newbranch
Ty80

git checkout New branch

git cherry-pick master

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!