'How to handle folder of git submodule which is marked as "untracked" in the host repo?
I've got a code base in which I want to add another repo as a submodule to do some integration testing. So following a tutorial I ran
git submodule add -b master [email protected]:kramer65/whisky.git
After that, a git status gives me this:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitmodules
whisky/
nothing added to commit but untracked files present (use "git add" to track)
As you can see the .gitmodules file is new, but the whisky/ folder also appears as untracked. After this I committed the .gitmodules file, but the whisky/ folder still appears as untracked.
How should I handle this? Do I need to add the whisky/ folder also to the "host repo"? Or do I need to add it to .gitignore? Or is there another way to handle this?
Solution 1:[1]
Just rerun git submodule add <URL>.
Git will see whisky/ as a submodule and won't track its files.
You can check it through git diff --cached whisky/ (git will only see it as a particular commit)
After all, just commit it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
