Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 745
Sam Moore Avatar asked Jan 19 '26 04:01

Sam Moore


1 Answers

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.

like image 178
blockhead Avatar answered Jan 20 '26 21:01

blockhead



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!