recover git repository to old version

落爺英雄遲暮 提交于 2020-01-06 14:14:53

问题


I had quite some problems after pushing large files in the git reposotory.

I tried different things messing up everything.

The last command I tried was

git filter-branch --tree-filter -f 'rm -rf FOLDERWITHLARGEFILES/*' HEAD

and it I thought I solved the problem because the following

git push origin master 

worked.

The problem is that now I have a very old version of my rep. I think that is the version before I tried to commit the large files. Is there a way to recover the repository.

To recap:

I tried to push large files. I continued working on my files I tried to solve the problem of pushing large files...

Thanks a lot in advance

Here the history of what I did:

1) I pushed the last time on May the 9th
2) I modified locally the code
3) I tried to push large files so git didn't allow me
4) I did some mess trying to cancel the commits like:
     $ git filter-branch -f --tree-filter 'rm -rf FOLDERWITHLARGEFILES/*' HEAD
     $ git filter-branch --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch DATA/*' --tag-name-filter cat -- --all
     $ git commit --amend -CHEAD
     $ git rm --cached FOLDERWITHLARGEFILES/
     $ git update-index --assume-unchanged FOLDERWITHLARGEFILES/
5) I pushed again today and I found both locally and in the rep the code at the last correct push (point 1)

来源:https://stackoverflow.com/questions/23627522/recover-git-repository-to-old-version

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!