summaryrefslogtreecommitdiff
path: root/doc/tips
diff options
context:
space:
mode:
authorGravatar http://id.clacke.se/ <clacke@web>2013-11-11 05:35:43 +0000
committerGravatar admin <admin@branchable.com>2013-11-11 05:35:43 +0000
commit2d4be566e66b5adbe0a0b889971df102b58f79c1 (patch)
tree06e6e2501247527d1cefeccf045fc632bed3e7da /doc/tips
parentaa543aa40edae8f18d7bc70a3493c9d740b7f25a (diff)
Diffstat (limited to 'doc/tips')
-rw-r--r--doc/tips/recovering_from_a_corrupt_git_repository.mdwn17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/tips/recovering_from_a_corrupt_git_repository.mdwn b/doc/tips/recovering_from_a_corrupt_git_repository.mdwn
new file mode 100644
index 000000000..084f76852
--- /dev/null
+++ b/doc/tips/recovering_from_a_corrupt_git_repository.mdwn
@@ -0,0 +1,17 @@
+I have found this the most reliable way to recover from a corrupt git repository. I have had a lot of them lately, there might be a regression in btrfs in Ubuntu's Linux 3.8.0-33 (!).
+
+1. Create a clone of a known good repository.
+2. Add the clone as an object alternate to the broken repository.
+3. Do a `git-repack -a -d` to lift the external objects into repo-local packs.
+4. Remove the clone
+
+[[!format sh """
+$ cd /tmp/
+$ git clone good-host:/path/to/good-repo
+$ cd /home/user/broken-repo
+$ echo /tmp/good-repo/.git/objects/ > .git/objects/info/alternates
+$ git repack -a -d
+$ rm -rf /tmp/good-repo
+"""]]
+
+... and push early, push often. ;-)