![]() ![]() Be aware that this will discard all non-committed changes. ![]() overlay, -no-overlay In overlay mode, the command never removes files when restoring. (I prefer to just enter the submodule and do the things myself, so that I can see what I am doing. Move into the submodule's directory, then do a git reset -hard to reset all modified files to their last committed state. Just like git-checkout(1), this will detach HEAD of the submodule. Run git submodule update -init if necessary to clone the two submodules. There are many additional flags to git submodule update to make it do other things. To add a new commit that fixes both submodules: Check out the superproject, at the tip of the branch that ends with the 'bad' commit. The name origin/master actually depends on configuration settings that's just the default. In this section, we are going to see how you can pull a Git submodule as another developer on the project. The only way to get this message to disappear is to do a submodule update or update the commit in the index (git add git commit).![]() Tells your superproject Git to run: (cd & git fetch & git checkout origin/master) Any time you run a submodule update it will reset HEAD to the commit specified in the index, and any time HEAD doesnt point to that commit for any reason youll get that message. On the other hand: git submodule update -remote Tells your superproject Git to run: (cd & git checkout )įor each submodule according to the hash ID currently stored in the index in the superproject. If there is a change in the submodule from the. The git submodule command can do some of this for you: git submodule update Once your cd inside a submodule, all git commands are with respect to the submodule and not the superproject. If you've changed the hash IDs you'd like the superproject to check out-by entering the submodule Git repositories and checking out other commits, for instance-you should run git add in the superproject to record the new hash IDs into the index for the superproject repository: git add ci metadataĪnd then run git commit in the superproject repository, to make a new commit that records these new hash IDs. That superproject lists which hash ID the superproject Git should use when the superproject Git runs: (cd & git checkout ) Note that this does not change the commit hash IDs recorded in the superproject (the current Git repository). You can repeat this for the metadata sub-directory that contains the metadata Git repository. So you could: (cd ci & git checkout origin/master)įor instance to change the commit that is checked out in the Git repository in the ci directory. This is a configuration file that stores the mapping between the projectâs URL and the local subdirectory youâve pulled it into: submodule 'DbConnector' path DbConnector url If you have multiple submodules, youâll have multiple entries in this file. If you want to change which commit is checked out in a Git repository, you enter the Git repository and run git checkout there. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |