硬重置Git存储库后,回滚到未被更改的更改 [英] Rollback to uncommited changes after hard reset a Git Repository
问题描述
未提交的更改表示 local 回购(即使您在amazon ec2上有远程回购)
这意味着您必须已经将( git add
)文件添加到本地克隆中,然后执行 git reset --hard
。
如果是这种情况,您仍然可以使用 rel =nofollow noreferrer> git fsck
,如恢复已添加到索引但通过 git reset
删除的文件:
- 首先,对当前的回购进行完整备份
- 然后尝试
git fsck --full --unreachable --no-reflog
Mistakenly, i hard reset my git repository. By doing this all the changes that i have made has been gone. Now, i want to rollback Git to all the uncommitted changes. Please help me with this.
"uncommitted changes" means local repo (even though you have a remote repo on amazon ec2)
That means you must have added (git add
) files to a local clone, then do a git reset --hard
.
If that is the case, you can still find those added files with a git fsck
, as described in Recover files that were added to the index but then removed by a git reset
:
- first, do a full backup of your current repo
- then try a
git fsck --full --unreachable --no-reflog
这篇关于硬重置Git存储库后,回滚到未被更改的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!