user2740614
user2740614

Reputation: 283

Git submodule preventing checkout (working directory is clean)?

I have a git project set up, with a superproject (let's call it suppy) and a subproject (let's call it subby). The branches of the project are seen below.

suppy
    -master
    -other

subby
    -master

The directory structure is:

suppy
    subby

I'm currently on branch other, an I'd like to checkout back to suppy's master. When I try, I get a git error saying that all the files in the submodule are untracked working tree files and would be overwritten by checkout. How do I resolve this so subby's files aren't blocking my path to suppy's master?

I'm in suppy, and running git status returns "nothing to commit, working directory clean". What's going on?

Upvotes: 0

Views: 404

Answers (1)

P_V
P_V

Reputation: 341

I had the same issue and found a way to get out of it. I did git checkout -f master. However at first it complained about a file that I had changed but had run git update-index --assume-unchanged [filename] on it previously. So I did a checkout on this file and then was finally able to checkout to the master branch with checkout -f master.

It made a bit of a mess in the submodules but with a combination of pulling from upstream, multiple submodule updates, checkouts on certain submodule folders and simply erasing some offending submodule folders I was able to get my master branch clean.

Upvotes: 1

Related Questions