问题描述
我修改了分支中的一些文件,并做了一个
只要执行 git reset master 即可。这只会更新索引以及 HEAD 指向的内容。它不会修改您的工作树文件。
I modified some files in my branch and did a
git add --allBut this added some files that I didn't intend to add for the commit.
So I did a
git reset --soft HEAD~2 (instead of doing git reset HEAD)But the previous commit was made by someone else and it caused a lot of files to be in modified/added/deleted status. Is there a way to get back to a stage where the only changes I see are the files added/modified by me? Since I didnt make an actual commit, is there a way to move my head back to master without blowing away my changes? git pull is causing merge conflicts as I didn't actually commit my changes.
Thanks!
解决方案Just do git reset master. This will only update the index and what HEAD points to. It will not modify your work tree files.
这篇关于恢复git reset --soft的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!