Sam Moore
Sam Moore

Reputation: 77

Git won't update a directory

I have a nicely functioning git repo on Bitbucket.org. However I have one directory that doesn't seem to be under my repo's control.

Whenever I push changes, anything in that directory is left behind. If I clone the repo into a new location, that directory shows up, but it's empty.

I think the directory contents were lifted from another project, probably in another git repo (I'm not the one coding this particular little bit of the project) - perhaps that's connected?

When I view the listing of this section of the repo in Bitbucket, that directory displays thus: commerce_shipworks → eb549bd63c0b [eb549bd63c0b]

Does this mean it's pointing to some other branch that I am not connected to? Bottom line - how can I regain control of this batch of code?

Any help appreciated.

Upvotes: 3

Views: 805

Answers (1)

blockhead
blockhead

Reputation: 9705

It looks like this is a submodule, or "accidental" submodule.

Is there .gitmodule file?

If not, it's likely an accidental submodule, meaning where somebody did a git clone into a subdirectory, and didn't remove the .git folder.

From this website:

Here is what you need to do in order to remove the submodule and add as a subfolder:

git rm --cached subfolder
git add subfolder
git commit -m "Enter message here"
git push

Now the origin should be able to see the contents of the subfolder.

Upvotes: 5

Related Questions