恢复git reset --soft [英] Recovering a git reset --soft
问题描述
我修改了分支中的一些文件,并做了一个
git add --all
但是这添加了一些我不打算为提交添加的文件。
所以我做了一个
git reset --soft HEAD〜2(而不是做git reset HEAD)
但是之前的提交是由其他人完成的,它导致很多文件被修改/添加/删除状态。有没有办法回到我看到的唯一变化是由我添加/修改的文件的阶段?由于我没有做出实际的承诺,是否有办法让我的头回到主人而不会吹掉我的变化? git pull导致合并冲突,因为我没有真正提交我的更改。
谢谢!
只要执行 git reset master
即可。这只会更新索引以及 HEAD
指向的内容。它不会修改您的工作树文件。
I modified some files in my branch and did a
git add --all
But 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!