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).
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 firstname.lastname@example.org: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..
I’m Jess, a Product Marketer for Jira Software Server and Data Center, and now a huge fan of our products. Read on for a 90 day, new-hire perspective on what it’s like to standardize on the Atlassian...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG