sh 将所有未提交的更改移动到新分支,并将现有分支恢复为HEAD。“master”具有未提交的更改。你决定了

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 将所有未提交的更改移动到新分支,并将现有分支恢复为HEAD。“master”具有未提交的更改。你决定了相关的知识,希望对你有一定的参考价值。

# get into the master branch
git checkout master

# create a new branch for the changes and check it out
git checkout -b dev_branch

# stash the changes until we revert master
git stash

# go back to master
git checkout master

# reset to the last commit
git reset --hard HEAD

# go back to dev_branch
git checkout dev_branch

# re-apply the stashed changes and you are good to go
git stash apply

以上是关于sh 将所有未提交的更改移动到新分支,并将现有分支恢复为HEAD。“master”具有未提交的更改。你决定了的主要内容,如果未能解决你的问题,请参考以下文章