summaryrefslogtreecommitdiff
path: root/_posts/2008-04-03-fix-a-bad-tree.markdown
diff options
context:
space:
mode:
authorCameron McEfee <cameron@github.com>2011-05-27 16:25:16 -0700
committerCameron McEfee <cameron@github.com>2011-05-27 16:26:19 -0700
commit75e24fdca4e70e751332c491a4b60a712e12c9e0 (patch)
treece505c13238ac1243de1026f85f26f848cd16d26 /_posts/2008-04-03-fix-a-bad-tree.markdown
parent379694ab364801b5d06c2070c43fa50594c4bf65 (diff)
Reorder files to alphabetize. Update titles to be more conducive to quick scans.
The posts have been re-dated to not only alphabetize them within their categories, but also to make them easier to find with their directory. Files marked 2008 are active post files. Files marked 2009 are outdated or are redirects to newer files. Files have been renamed to match their title for easier updating.
Diffstat (limited to '_posts/2008-04-03-fix-a-bad-tree.markdown')
-rw-r--r--_posts/2008-04-03-fix-a-bad-tree.markdown56
1 files changed, 56 insertions, 0 deletions
diff --git a/_posts/2008-04-03-fix-a-bad-tree.markdown b/_posts/2008-04-03-fix-a-bad-tree.markdown
new file mode 100644
index 0000000..95be750
--- /dev/null
+++ b/_posts/2008-04-03-fix-a-bad-tree.markdown
@@ -0,0 +1,56 @@
+---
+layout: default
+title: Fix a bad tree
+description: How to fix the bad tree error on a github repo caused by egit
+categories: troubleshooting
+---
+
+Due to a bug in egit's implementation of the `git rm` command, empty trees may not be removed from the index and result in a "bad tree" error on github:
+
+![](https://img.skitch.com/20110308-875n82b15ktc8kc34wdaj1euky.jpg)
+
+Fixing the repo
+---------------
+
+Fixing this error is fairly simple with the commandline. To fix the error you need to recreate the tree and then remove it using `git rm` to ensure it is removed correctly.
+
+For example, if the bad tree is at `badtree/` we would run:
+
+<pre class="terminal">tekkub@iSenberg ~/tmp/fixing_bad_tree master
+> mkdir badtree
+
+tekkub@iSenberg ~/tmp/fixing_bad_tree master
+> touch badtree/temp
+
+tekkub@iSenberg ~/tmp/fixing_bad_tree master
+> git add badtree/temp
+
+tekkub@iSenberg ~/tmp/fixing_bad_tree master+
+> git commit -m "Fixing bad tree, step one"
+[master dbe6a08] Fixing bad tree, step one
+ 0 files changed, 0 insertions(+), 0 deletions(-)
+ create mode 100644 badtree/temp
+
+tekkub@iSenberg ~/tmp/fixing_bad_tree master
+> git rm badtree/temp
+rm 'badtree/temp'
+
+tekkub@iSenberg ~/tmp/fixing_bad_tree master+
+> git commit -m "Fixing bad tree, step two"
+[master 46ae6d2] Fixing bad tree, step two
+ 0 files changed, 0 insertions(+), 0 deletions(-)
+ delete mode 100644 badtree/temp
+</pre>
+
+We can then confirm the tree is removed by making sure it is not listed by `git ls-tree`:
+
+<pre class="terminal">tekkub@iSenberg ~/tmp/fixing_bad_tree master
+> git ls-tree -r HEAD | grep badtree
+</pre>
+
+If this returns no results, push the repo and everything should be fixed!
+
+Avoiding future corruption
+--------------------------
+
+We recommend users avoid using egit to remove files from their repos. Always use `git rm` from the command line.