0

So the problem here is I have my code in some-git repository build with maven with branches master and myBranch. The present master structure is : Project_ | Core Driver Tests _ XTest |_ YTest

And recently I have made changes onto myBranch refactoring modules and directories. Project_ | Core[core] Driver[driver] XTests[x-test] // format [] YTests[y-test]

Using intelliJ and currently on myBranch as I checkout master the entire structure is restored but the directories XTests and YTests would not be removed. Any ideas onto why this is happening and what's the solution to get this corrected so that the directories are no more there?

Note : Not the entire directory remains but just the resources from XTests and YTests under /src/main/resources are still there in the project.

Naman
  • 27,789
  • 26
  • 218
  • 353

1 Answers1

0

Try to checkout your branch to a different folder than your original work folder, git will not delete the existing folders (from the different folder structure) to this new one - so you would still have folders in Tests\x-test and Tests\y-test.

However, git clean -fd could be used to remove untracked directories.

Naman
  • 27,789
  • 26
  • 218
  • 353
javapapo
  • 1,342
  • 14
  • 26
  • couldn't get you there,could you exemplify the solution – Naman Feb 03 '16 at 14:58
  • What I am trying to say is that git wont delete directories. So when you switch from one branch to another and you expect that directories that used to be in a specific folder, now to be deleted or removed because you changed the structure in another branch, (what you actually did from master to mybranch) it wont happen! See [here](http://stackoverflow.com/questions/1499157/git-checkout-pull-doesnt-remove-directories) for related answers on this specific behavior – javapapo Feb 03 '16 at 15:40
  • `git clean -fd` does clean the unused directories after checking out a different branch – Naman Feb 22 '16 at 11:22