Many actions that you might perform that relate to submodules are done with the git submodule command, but in older versions of git this has two problems that make it very easy to get confused – I think these are important enough that everyone who uses submodules should be aware of them, and ideally upgrade their copy of git to a version that doesn’t have these problems: at least version 1.6.2. … it’s worth checking what version of git you have. (More on that below.) If you change directory into the submodule then you’ll find that it doesn’t know anything about the the parent project at all, and you can carry out operations in that repository as if it were standalone. It’s important to understand that the repository which contains a submodule knows very little about it except for which version it should be and various bits of information about how to update it. (I’ll sometimes refer to the whatdotheyknow repository as the super-project, which I hope is clear.) In each project the commonlib repository has been added as a submodule. The example I’m going to use in this post however, called whatdotheyknow, is one of the various mySociety projects that depend on a repository called commonlib, which contains useful code common to at least one project. For example, if you’re developing a new Ruby-on-Rails application, you could add a clearly specified version of the Rails repository as a submodule at the path vendor/rails. This is a useful feature when you have a project in git which depends on a particular versions of other projects. What are submodules?Ī submodule in a git repository is like a sub-directory which is really a separate git repository in its own right. Submodules in git are commonly misunderstood in various ways, and although the explanation in the official manual is clear and pretty easy to understand, I thought that a different treatment here might be useful to someone. Therefore, a commit of a superproject also contains the name of the submodule directories, along with the current commit of these submodules.I haven’t actually finished the FAQ bit of this post yet, but since I’m not sure when I’ll have time to do so, I’ll just publish it anyway – please let me know in the comments if this is useful for you, or there’s something else you’d like to see included. You want the version that actually works with your status of fiji. Most of the time you do not want to have the newest coolest version of the submodule. What is the difference between calling git supmodule update from the fiji directory and changing into a submodule directory and doing a git pull? This is probably the opposite way round from what you expect from resolving conflicts while merging :) Difference between git submodule update and git pull git diff -ours shows the differences between the “master” or “upstream” branch and the working tree.git diff -theirs shows the differences between the “server” branch and the working tree.If you’re using git diff -theirs and git diff -ours while rebasing then you may get confused. Now we should be able to continue, with git rebase -continue A note on “ours” and “theirs” The usual sequence of commands when working inside a submodule: See the Submodules section of the Downloading and Building Fiji From Source page for details. However, to work with a submodule you must clone that repository. Checking out submodulesĮach submodule is a proper full-fledged git repository, so any git commands executed within the folders of the submodule will affect that git repository, not fiji’s. that 40-digit hex string which is the unique identifier of each commit) of that submodule. Submodules, although existing as folders inside the fiji repository, are different: only the folder name, as a path pointer, is registered as belonging to fiji’s git repository, together with the current revision (“commit name”, i.e. With git, any git command executed within any subdirectory of the repository affects the overall git repository. Submodules in Fijiįiji is hosted on a main git repository which contains several declared submodules such as TrakEM2. When in doubt, ask for help from the community. This section is out of date, potentially misleading or invalid.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |