2

I'm using EGIT to manage my GIT repository, which seems to work well so far. However, when I switch from one branch to another the files are correctly switched, however empty directories and packages that exist in one branch but not the other are left over.

I understand that GIT is based on the actual files and not the directories, however this is not ideal as my one branch was a large refactoring and therefore contains many packages that the master branch does not have.

From my research there appears to be a GIT command git clean -d that should cleanup the directories. Does EGIT support this? Or is there a way to execute this command when switching the branch with EGIT?

David
  • 699
  • 7
  • 18

1 Answers1

1

That looks like bug 345585: "EGit does not prune empty folders when switching branches".

It is still opened, so for now, the git clean -d is your best option (but outside of Eclipse, in a shell session).


Update June 2013, for Egit 3.0 Kepler:

A clean action has been added to the repositories view now.

clean egit action

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • How though do I execute that command from EGIT? Or do I need to connect to the GIT repository via GIT Bash? I'm a GIT noob. – David Jul 04 '11 at 15:04
  • @David: you would open a bash session, go to the root directory of your project currently shared with Git (the one directory with the `.git` in it), and run the `git clean -d`. – VonC Jul 04 '11 at 15:06
  • Sorry, re-read your post, need to do it with the shell. Thanks. – David Jul 04 '11 at 15:06
  • 1
    @David: beware of http://stackoverflow.com/questions/6267180/can-i-undo-a-git-clean-fdx or http://stackoverflow.com/questions/3681474/git-clean-fdx-recovery-possible: use `-n` for a dry run, as mentioned in http://stackoverflow.com/questions/5879932/git-clean-not-working-recursively – VonC Jul 04 '11 at 15:08
  • 1
    Thanks for the followup... -n just saved my day – David Jul 04 '11 at 15:42