2

So I've successfully deleted a directory and its history from git.

With something like:

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch folder-to-delete" HEAD

However, my git commit log still contains the commits for that directory. When I look at my repository history I see all the commits for those directories. They have no files in them (as expected), but the commits are still in the history.

Is it possible to delete these commits from the history as well?

Kyle Kelley
  • 13,804
  • 8
  • 49
  • 78
Michael Wiles
  • 20,902
  • 18
  • 71
  • 101
  • [This](http://git-scm.com/book/ch6-4.html), and [this](http://stackoverflow.com/questions/37219/how-do-you-remove-a-specific-revision-in-the-git-history) might help. – devnull Oct 30 '13 at 12:00
  • I've already done all that... now I've got a bunch of orphaned commits in my commit log. – Michael Wiles Oct 30 '13 at 12:23

1 Answers1

2

Add the --prune-empty switch on git filter-branch to remove now-empty commits from your history.

(Related)

Community
  • 1
  • 1
Ash Wilson
  • 22,820
  • 3
  • 34
  • 45