I have a parent (git) project with a submodule (git).
However, when I update the submodule in the parent/develop branch, the parent/master branch also contains the updated submodule files...
So while I want to test my parent code with the updated submodule code, the updates submodule code already appears in master ... what a disaster... that could create.
How do I solve this?
(Using SourceTree git on Mac).
See http://git-scm.com/book/en/Git-Tools-Submodules
Switching branches with submodules in them can also be tricky. If you create a new branch, add a submodule there, and then switch back to a branch without that submodule, you still have the submodule directory as an untracked directory:
$ git checkout -b rack Switched to a new branch "rack" $ git submodule add git@github.com:schacon/rack.git rack Initialized empty Git repository in /opt/myproj/rack/.git/ ... Receiving objects: 100% (3184/3184), 677.42 KiB | 34 KiB/s, done. Resolving deltas: 100% (1952/1952), done. $ git commit -am 'added rack submodule' [rack cc49a69] added rack submodule 2 files changed, 4 insertions(+), 0 deletions(-) create mode 100644 .gitmodules create mode 160000 rack $ git checkout master Switched to branch "master" $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # rack/
You have to either move it out of the way or remove it, in which case you have to clone it again when you switch back—and you may lose local changes or branches that you didn’t push up.
=> So, suppose that is just the way it is..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.