GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing imagej.net — Git submodule tutorial ImageJ Docs
Page contentsThis section is out of date, potentially misleading or invalid. Be careful with any instructions here. When in doubt, ask for help from the community. Submodules in FijiFiji is hosted on a main git repository which contains several declared submodules such as TrakEM2. With git, any git command executed within any subdirectory of the repository affects the overall git repository. 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. that 40-digit hex string which is the unique identifier of each commit) of that submodule. Checking out submodulesEach 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. However, to work with a submodule you must clone that repository. See the Submodules section of the Downloading and Building Fiji From Source page for details. Submodule workflowThe usual sequence of commands when working inside a submodule: Say you observe some unstaged changes. Just add and commit them: You can work as much as you like inside the submodule, and if you have something you want to commit to Fiji, the superproject, first make sure you pushed the changes of the submodule! Then move up and add the current revision of the submodule inside fiji. BE CAREFUL: adding “TrakEM” and “TrakEM/” is not the same at all! The latter would add all non-ignorable files under TrakEM2’s subfolder into fiji’s repository, which is NOT what you want. If you screwed up, use After the above, fiji has been updated to track the latest TrakEM2 commit. When happy with the arrangement, push the changes to the shared repository for others to see them. Remember to push both separately: the submodule and fiji’s repository itself! If you push only fiji, then whoever pulls fiji will not see the new HEAD of the submodule branch, which will result in an error. Resolving Submodule ConflictsWhen merging and rebasing fiji, you are likely to end up having to fix conflicts in the versions of submodules. These next two sections are intended to help you to resolve these conflicts. Submodule Conflicts while MergingYou are most likely to have submodule conflicts while merging when you run Submodule Conflicts while RebasingConflicts in submodule versions while you’re rebasing are slightly different. For example, suppose I am in the following situation: And I want to rebase server onto main, by doing the following: The If you get a message saying you have to resolve conflicts that means that “git status” will tell you what they are. In this case I get: In this case, there’s only one problem: versions of the VIB submodule conflict. Let’s say that the situation now corresponds to the following diagram: First, it’s important to see what change in version that commit is trying to make, so take the partial SHA1 sum from the line “Could not apply” above and pass it to git show, so Now just to check that we understand what’s going on, run three versions of the diff command. First, show differences between the the last successful commit in this rebase and the working tree version: That shows us that the version in the old commit is as we expect (good!) The version in the Now we should be able to continue, with A note on “ours” and “theirs”If you’re using
This is probably the opposite way round from what you expect from resolving conflicts while merging :) Difference between git submodule update and git pullWhat is the difference between calling git supmodule update from the fiji directory and changing into a submodule directory and doing a git pull? Most of the time you do not want to have the newest coolest version of the submodule.. You want the version that actually works with your status of fiji. Therefore, a commit of a superproject also contains the name of the submodule directories, along with the current commit of these submodules. Now sets the submodule to the commit that is saved with the commit of fiji. Whereas actually gives you the newest hottest version of that submodule, that is potentially not even compiling with your current status of fiji. So what happens if I do “git submodule update”, but in the submodule I am on an experimental branch, that is not valid for the superproject? This will set the submodule to the status valid for your current fiji commit, if you are not on the branch specified, it will detach the HEAD you are on. This means you will be on a no-name branch in the submodule now (for this to work you must not have any uncommited changes in the submodule branch you were on before) |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |