1

So I have some folders that were tracked some time ago and added to the git history. Somehow, their content was ignored (gitignore) but everyone has them on their machine - I wasn't on the project from the beginning.

Now, their contents and the folders themselves are not needed anymore, but git doesn't see folder removal as an action.

How do I get git to record their deletion as an action so that other people get their repo cleaned up too? I'm a bit afraid of actions that change the whole history tree.

Ilea Cristian
  • 5,741
  • 1
  • 23
  • 37
  • Is `.gitignore` versioned? If so: Remove the folders' paths from `.gitignore` file? Then `git` will see them and will be able to remove them. – buff Jul 01 '14 at 20:13
  • 1
    Git doesn't track directories, so it won't remove ones that become empty as a result of a merge or other change. – Ilea Cristian Jul 01 '14 at 20:38

1 Answers1

1

Since, as you noticed, Git does not track empty folder (because they have no content), one way is to instruct your colleagues to use git clean:

git clean -f -d

That will remove untracked directories in addition to untracked files.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250