The relevant change, in this case, is that we’re using commit b223084 of some external source (~/externalsoftware), not the actual contents of ~/externalsoftware. When your code is peer-reviewed, a lot of extra code pollutes your actual changes.This “just works”, but has a few drawbacks: The easiest way of including external code in your git repo is to just copy it there. ![]() To do this manually-so that you have control over the result, rather than just assuming that some computer program has produced the right answer (i.e., 42) even if you're not sure what the question was-you would do these same steps, but probably actually look at what each one did before going on to the next one.# nothing to commit, working directory clean run some second Git operation-such as git checkout-using that hash ID.use the branch name you set earlier (as the submodule's "branch" setting) to figure out a hash ID, as perhaps updated by the git fetch in step 2.So the all-in-one git submodule update -remote operation does just that: This git fetch must be run in the submodule Git, not the superproject Git: these are after all separate, mostly-independent Git repositories. Remember that it is git fetch that obtains new commits and updates remote-tracking names like origin/master. The git fetch operation is what obtains new commits and updates the name, so that the branch name you set earlier takes on a new hash ID value after the git fetch. In all cases, git submodule will first run git fetch in the submodule repository, unless you inhibit this with -no-fetch or -N. ![]() The hash ID of the commit to use for the rebase is determined by the branch name. ![]() Rebase: this means rebase the current commit onto another commit. The hash ID of the commit to use for the merge is determined by the branch name. Merge: this means merge the current commit with another commit. The hash ID of the commit to check out in the submodule is determined by the branch name. If you do want to use git submodule update -remote, this is when the branch setting for the submodule means something.Īt this point, you must now choose one of the three specific modes:Ĭheckout: this means switch to a commit. I personally prefer, in most cases, to take direct control of each submodule by navigating into the submodule. Otherwise-e.g., if the new lib/payment-sdk requires some fixes or updates to the superproject-make any other superproject changes you need to make, git add them as well, and then git commit to make the new commit.ġYou can also automate this a bit, using git submodule update -remote, but the details get rather complicated. If that's the only update you need to make to the superproject, you can now go ahead and commit: git commit To tell the superproject that in the next commit you make, you'd like the superproject to command the submodule to use the same commit it's using right now. If all goes well, then, in the superproject, you run: git add lib/payment-sdk 1 The submodule remains on that commit while you build and test in the superproject. Just enter the submodule-it's a separate repository, after all-and git checkout the commit you want to test. Now, if you're working in your repository, and you notice that there's a new commit for the submodule and you'd like to test it, you can do that quite easily. ![]() See footnote 1 for more about the use of the branch name. Setting the branch of the submodule does not change the above. The submodule Git dutifully checks out that particular commit, as directed by the superproject git ( git submodule update). The superproject says, in effect: for the current superproject commit, use commit XYZ for submodule lib/payment-sdk. When using submodules, you pick a particular commit in the superproject. What happens if the latest version was updated five minutes ago to an incompatible version? Your main module can't use that version. The goal of a submodule is to get a specific version, not just "the latest"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |