Created
February 7, 2009 04:42
-
-
Save eadz/59763 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let’s say that you have a submodule in your project called ’submodule1′ and it’s in the following path: ‘vendors/submodule1′. In git there are 3 traces of this this submodule: | |
1) .gitmodules | |
2) .git/config | |
3) the submodule entry in the index/commit itself. | |
To remove the first two, is really simple, you just edit those files and remove the lines that specify the submdoule. In order to delete the third and last trace of the submodule in git, you need to type the following command: | |
git rm --cached path/to/submodule | |
Note: Do not put a trailing slash at the end of path. If you put a trailing slash at the end of the command, it will fail. | |
UPDATE a submodule | |
On the other hand, sometimes you are going to want to track a more recent revision. How do you do that? Well, just the same as we do with another git repository (because this is a fully fledged git repository!): | |
mathie@tullibardine:books$ cd vendor/plugins/rspec/ | |
mathie@tullibardine:rspec$ git remote update | |
Updating origin | |
mathie@tullibardine:rspec$ git merge origin/master | |
Already up-to-date. | |
(Unfortunately, I’m writing this in realtime and there were no changes to pull since I started writing it!) That will pull the latest version of RSpec from github and update your local repository. Once you’ve done that, change back into the root of your project and do a git stat: | |
mathie@tullibardine:rspec$ cd ../../.. | |
mathie@tullibardine:books$ git stat | |
# On branch master | |
# Changed but not updated: | |
# (use "git add ..." to update what will be committed) | |
# | |
# modified: vendor/plugins/rspec | |
# | |
no changes added to commit (use "git add" and/or "git commit -a") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment