Repair corrupted Git repository
My solution for a similar situation was to replace a hash of the damaged object in .git/refs/heads/my-working-branch with a hash of previous commit (which can be found in .git/logs/HEAD).
My solution for a similar situation was to replace a hash of the damaged object in .git/refs/heads/my-working-branch with a hash of previous commit (which can be found in .git/logs/HEAD).
To repair a corrupt database you can use the sqlite3 commandline utility. Type in the following commands in a shell after setting the environment variables: cd $DATABASE_LOCATION echo ‘.dump’|sqlite3 $DB_NAME|sqlite3 repaired_$DB_NAME mv $DB_NAME corrupt_$DB_NAME mv repaired_$DB_NAME $DB_NAME This code helped me recover a SQLite database I use as a persistent store for Core Data and … Read more
UPDATE: There is now an automatic method that is built into SQLite: .recover Sometimes, the corruption is only or mostly in indexes, in which case it would be possible to get some or most records by trying to dump the entire database with .dump, and use those commands to create a new database: $ sqlite3 … Read more
In some previous backups, your bad objects may have been packed in different files or may be loose objects yet. So your objects may be recovered. It seems there are a few bad objects in your database. So you could do it the manual way. Because of git hash-object, git mktree and git commit-tree do … Read more
If the problem is with the index as the staging area for commits (i.e. .git/index), you can simply remove the index (make a backup copy if you want), and then restore index to version in the last commit: On OSX/Linux/Windows(With Git bash): rm -f .git/index git reset On Windows (with CMD and not git bash): … Read more