diff --git a/doc/forum/safely_dropping_git-annex_history/comment_9_f83d6090aea2b7d5d54c876df940cbad._comment b/doc/forum/safely_dropping_git-annex_history/comment_9_f83d6090aea2b7d5d54c876df940cbad._comment new file mode 100644 index 0000000000..cbfd678508 --- /dev/null +++ b/doc/forum/safely_dropping_git-annex_history/comment_9_f83d6090aea2b7d5d54c876df940cbad._comment @@ -0,0 +1,40 @@ +[[!comment format=mdwn + username="https://www.google.com/accounts/o8/id?id=AItOawln3ckqKx0x_xDZMYwa9Q1bn4I06oWjkog" + nickname="Michael" + subject="git checkout --orphan" + date="2013-07-19T17:49:37Z" + content=""" +Instead of rebase, --orphan seems to be the right answer for pruning history: create a new git-annex orphan branch and git add and commit the files. So: +
+
+git status
+
+# verify there are no uncommitted or untracked files
+
+# master branch
+git branch -m old-master
+git checkout --orphan master
+git add .
+git commit -m 'first commit'
+
+# git annex branch
+git branch -m git-annex old-git-annex
+git checkout git-annex
+git checkout --orphan git-annex
+git add .
+git commit -m 'first commit'
+git checkout master
+
+# at this point, you may want to double-check that everything is still OK
+
+# finally, remove branches and clean up the objects:
+git branch -D old-master old-git-annex
+git reflog expire --expire=now --all
+git prune
+git gc
+
+
+
+The repo remains functional and .git is smaller.
+
+"""]]