Can't rmdir when switching between branches with submodules in SourceTree on Windows


I have a repo with two branches. The 'master' branch does not have any submodules. The other branch ('revamp') has two submodules in it ('awesome' and 'bootstrap'). In SourceTree on Windows 7, when I switch to the branch that does not have submodules, I receive the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false checkout master
warning: unable to rmdir vendor/awesome: Directory not empty
warning: unable to rmdir vendor/bootstrap: Directory not empty
Switched to branch 'master'

git -c diff.mnemonicprefix=false -c core.quotepath=false submodule update --init --recursive
Completed successfully.

This problem does not happen to my colleagues using SourceTree on Mac. Also I get the same error trying to use the command line 'git checkout -f master' as well. So I think it's related to Windows.

Can anyone help?

1 answer

1 accepted

Technically this is a warning rather than an error, the actions you're performing are still succeeding.

This Stack Overflow post has a good description of the reason why switching between branches with different submodules can cause problems, and what you can do about it:

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you