Impossible to get a root submodule working on Git
git submodule add
git submodule remove
git submodule update not working
git submodule commit
git update submodule to latest
git submodule alternative
git submodule not pulling
I've create a submodule in my repository root in a specific folder.
I can see the submodule is well registered in .git/.gitmodules and in .gitmodules, but I can't get it working.
I can't see it if I make a git submodule status or if I make an update.
Git can't just see this submodule (others are working well).
Do you have any trail ?
Thanks for your time
One idea - you're trying to add an empty repo as submodule. You need to have at lease one commit in submodule, because it is linked by commit id. Try to execute this command in root repo:
git ls-tree HEAD -r
Do you see your submodule in results? The line should look like this:
160000 commit 72a0f63227341c35af566de0d6d4a76797ba22b2 my_submodule_dir
private submodule checkout fails @v2 · Issue #116 · actions , I've private git submodule, which contains our shared i18n resouces, with same Unable to check out SSH submodule using deploy key #183 while it did work before with a submodule that was located on the root folder of If the option --files is given, show the series of commits in the submodule between the index of the super project and the working tree of the submodule (this option doesn’t allow to use the --cached option or to provide an explicit commit). Using the --submodule=log option with git-diff will provide that information too.
Git was not able to recognize the submodule, whatever I do.
Without any modifications, I've just :
- Delete the submodule folder
- Add the submodule
The submodule now works correctly.
Note that Git doesn't add a new submodule, he has just recognize the submodule as it should.
Thanks for all your answers
Mastering Git submodules - Christophe Porteneuve, Submodules have been around for a good long while, have their own Git command Working around this by littering your submodule repo with container-specific your local, interactive repo (that is, with a working directory alongside its .git root). Unable to checkout '12e3a529698c519b2fab790630f71bd531c45727' in Git provides submodules to help with this. Submodules allow you to include or embed one or more repositories as a sub-folder inside another repository. For many projects, submodules aren’t the best answer (more on this below), and even at their best, working with submodules can be tricky, but let’s start by looking at a straight-forward example.
Another case where git submmodule status does not see (fully) a submodule is when said submodule just got created (init, but not updated yet)
That is problematic, because there was a bug fixed with Git 2.18 (Q2 2018) :"
git submodule status" did not check the symbolic revision name it computed for the submodule HEAD is not the NULL, and threw it at
printf routines, which has been corrected.
submodule--helper: don't print
NULLsometimes (e.g. right after '
submodule init'). The current code makes '
submodule status' print this:19d97bf5af05312267c2e874ee6bcf584d9e9681 sha1collisiondetection ((null))
This ugly '
null' adds no value to the user using this command. More importantly,
printf()on some platform can't handle NULL as a string and will crash instead of printing '
Check for this and skip printing this part (the alternative is printing '
(n/a)' or something but I think that is just noise).
git-submodule Documentation, If the superproject doesn't have a default remote configured the superproject is its own If --force is specified, the submodule's working tree will be removed even if it the relative path from the current working directory to the submodules root Git Submodules: Adding, Using, Removing, Updating I’ve spent a little more than a month working with Git now. I can honestly say that while there are many things that I like about Git, there are just as many things that I personally find to be a pain in the butt.
How do git submodules work?, Submodules are useful when you have a project that is under git version control git commit -m "Initial commit on myproject" [master (root-commit) 196bbbb] Initial As you saw, the output from git submodule says Cloning into subproject , and That is a bit difficult to see at the moment, because the directory listing is in the Although DbConnector is a subdirectory in your working directory, Git sees it as a submodule and doesn’t track its contents when you’re not in that directory. Instead, Git sees it as a particular commit from that repository.
Git Submodules: Adding, Using, Removing, Updating :: Chris Jean, I'll cover two of the more difficult things to figure out: removing and updating If lib/billboard isn't the only submodule, the .gitmodules file will have to be modified by hand. Initialize the repository's submodules by running “git submodule init” followed by “git Now switch back to the root working directory of the repository. Deleted submodule: A submodule can be deleted by running git rm <submodule path> && git commit. This can be undone using git revert . The deletion removes the superproject’s tracking data, which are both the gitlink entry and the section in the .gitmodules file.
Using submodules in Git - Tutorial, Working with repositories that contain submodules. 2.1. working directory and is configured via a .gitmodules file located at the root of the parent repository. Git allows you to commit, pull and push to these repositories independently. git submodule update --init # if there are nested submodules: git Nothing. When you git clone a project with submodules, git does not clone the submodules. Getting the submodule repository clone takes two steps. These are: initialize with git submodule init; clone with git submodule update. Initializing the submodule copies the repository submodule information in .gitmodules to the repository .git/config file.
- Did you make a
git submodule update
- Did you move the original repository after creating the submodule, or run it Windows? There are problems like this with submodules created with 1.7.8 and 1.7.9 (this is fixed in 1.7.10)
- An update change nothing, Git just can't see the submodule when I'm running the git submodule command. I haven't move the repo since I've started the development.
- Thanks for your answer, I can see these lines, but I've one of them for every file of my submodule. Any idead on what happened ? Note that the repo of the submodule is full of commits.
- The key moment is that object type in tree must be "commit", this means a submodule. For normal files/folders you see "tree" or "blob" type. You can try to find it with grep, like this: git ls-tree HEAD -r | grep " commit "
- P.S. If submodule is not empty, then my original suggestion is wrong
- Submodule are not empty, I can see each file of the submodule with git ls-tree HEAD -r
- Submodule is a completely standalone repository with it's own history and tree. So when you execute 'git ls-tree HEAD -r' in root repo, you sholdn't see files in submodule. If you see them, then git doesn't think of this folder as of submodule. I would try to delete it completely and add again with 'git submodule add'