我不小心在分支“ develop”中进行了几次提交,而不是在“ task”分支中进行了几次提交。现在,当我从development创建新分支时,我总是拥有这些先前的提交。因此,我需要从存储库中拉出所有开发分支,并需要丢弃所有本地更改和提交。在没有完整克隆存储库到新文件夹的情况下该怎么办?
# on your develop branch
$ git checkout develop
# create the branch you want that should have the commits in develop
$ git branch task
# force the develop branch back to its original state
$ git reset --hard origin/develop
# switch to your task branch, and continue committing
$ git checkout task