撤消git过滤器分支 [英] Undo git filter-branch
本文介绍了撤消git过滤器分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用git filter-branch意外地从我的回购库中删除了一个文件:
git filter-branch -f --index -filter'git rm --cached --ignore-unmatch images / thumb / a.JPG'HEAD
我该如何解决这个问题?可能吗?也就是文件被永久删除了?
解决方案
$ b
当您使用 git filter-branch $ c $
$ b
refs / original / refs / heads / master
如果您在分支 master
中使用了该命令。您可以检查是否在 .git / refs
目录中有备份。考虑到这一点,你可以使用这个备份来恢复你的文件:
git reset --hard refs / original / refs / heads / master
I accidentally delete a file from my repo using git filter-branch:
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch images/thumb/a.JPG' HEAD
How can I undo this? Is it possible? i.e. is the file permanently deleted?
解决方案
When you use git filter-branch
, a backup file is created in
refs/original/refs/heads/master
If you used the command in branch master
. You can check if you have the backup in .git/refs
directory. With this in mind, you can use this backup to recover your files with:
git reset --hard refs/original/refs/heads/master
这篇关于撤消git过滤器分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文