Question

I lost some code from my local machine, and I think I have the objects in the github repository, the problem is, they are dangling objects and I don't know how to fetch them, is there a way to fetch them?

Here is how it all happened (including my stupidity in it):

I have a repository that contains some huge SQL data (the repo is around 300M), since the repository size was making git clone slow I went ahead and deleted the huge files.

After git filter-branch 'git rm ...' I fixed my tests that depended on the deleted data, and wrote some code, I commited the changes and git push --force origin them into github.

When I tried to rebase with this "new" repository, it just felt in its face. git filter-branch 'git rm ...' changed the very first commit, so everything became a conflict.

Because I couldn't rebase I decided to try something different, I deleted the repository from my local machine, and git push --force my backup from the old repository into github.

That is how I lost some work.

I think that the objects are still in github because their article on how to remove sensible data says:

This article tells you how to make commits with sensitive data unreachable from any branches or tags in your GitHub repository. However, it's important to note that those commits may still be accessible in any clones or forks of your repository, directly via their SHA-1 hashes in cached views on GitHub, and through any pull requests that reference them. You can't do anything about existing clones or forks of your repository, but you can contact support to permanently remove all of your repository's cached views and pull requests with the offending commits.

Était-ce utile?

La solution

The comment tells you just, that you may have other copies of the whole project, due to unrecognized clones or forks.

If so, you had luck - verify it's really untouched then just push the untouched repo to your remote.

In the case you don't had luck i suggest you to follow these steps:

  1. Make a complete deep copy (it must contain .git of your repoistory-folder as a backup.
  2. Read that chapter about data recovery and this post and try different strategies to recover your data. If something fails badly, make a copy from your backup again.

And whatever you read anywhere avoid git gc.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top