Reputation: 1010
The objective is to commit a git branch. The output of "git status" for the branch is:
On branch zeromq_new
Your branch is up to date with 'origin/zeromq'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: log4cplus (modified content, untracked content)
modified: ../lib/notification/cppzmq (modified content)
The directory structure looks like this:
HySecureGateway
├──fes
│ └──log4cplus
│ ├──.git
│ ├──.gitattributes
│ ├──.gitignore
│ ├──.gitmodules
│ ├──catch
│ │ ├──.git
│ │ ├──.gitattributes
│ │ ├──.github
│ │ ├──.gitignore
│ │ └──.github
│ │ ├──issue_template.md
│ │ └──pull_request_template.md
│ └──threadpool
│ └──.github
└──lib
└──notification
└──cppzmq
├──.git
└──.gitignore
I read an answer of to a similar question here:
How to track untracked content? ,
and couldn't understand it completely. Also the logc4plus/.gitmodules contains this:
[submodule "threadpool"]
path = threadpool
url = https://github.com/log4cplus/ThreadPool.git
[submodule "catch"]
path = catch
url = https://github.com/philsquared/Catch.git
Upvotes: 75
Views: 145677
Reputation: 1344
Remove .git from folders which are not being added into git stage. This is the simplest way
If you can't find it or hidden do the following. In Finder, open your Macintosh HD folder. Press Command + Shift + . (period) to make the hidden files appear.
-->> not working for me
git rm -rf --cached
Upvotes: 0
Reputation: 10256
cd your_submodule
git clean -fdx .
That's it. No need to manually remove any sensitive files or re-download anything.
Upvotes: 0
Reputation: 21
I faced the same issue, I had a folder structure like this,
/project
---> /client
---> /server
The client folder was untracked because it was a git repository in itself. I followed the following steps to resolve the problem
1) remove .git file from client folder
2) run the command "git rm -rf --cached client"
3) git add client
4) git push -u origin main
Upvotes: 2
Reputation: 1
i solved the problem by moving in sub folder which what not tracking and run
these command: git add . git commit -m "my commit"
then back to main folder and run again these command
Upvotes: 0
Reputation: 327
Solution involves removing .git/
from the directories with the "modified content, untracked content" label, removing the --cached
filed from those directories, and then running git add
on those directories once again.
Step-by-step solution:
.git/
from log4cplus and ../lib/notification/cppzmq
.git rm -rf --cached log4cplus/ && git rm -rf --cached ../lib/notifications/cppzmq
Upvotes: 10
Reputation: 149
For some reason these separate repos have altered files. There are a couple ways to deal with it, depending what they actually are.
You can navigate into each repo and see what files are changed. Then you can commit, make a new branch, or get rid of the changes.
If these repos are seperate projects that you want to track but not mess with, you can make your parent repo simply ignore changes in these submodules with:
git update-index --assume-unchanged $DIRECTORY
(where $DIRECTORY
is the submodule you want to ignore changes to).
Upvotes: 7
Reputation: 11
log4cplus is your submodule that has modified and untracked contents.
Now you should be able to update the commits from the submodule onto your main or outer repository. Please note that deleting the .git file in your submodule is not a solution.
Upvotes: 1
Reputation: 59
I also encountered such a problem, and it indeed bothered me a lot.
I solved it by running git submodule update
.
Upvotes: 3
Reputation: 149
What happening here is that you are in your root Folder Folder and You want to push all your children to git repository.So a git file is created.And if you get a untraceable or untracked file error the reason is some on your childen directories also have a git repository with it.You can delete the git repository from the untracked or untraceable folder by command ---->rmdir -Force -Recurse .git This command will delete the local git repo in your untracebale or untracked directory and once again go to your root folder and type the same command. Reinitialize the git repo and its Done!!!
Upvotes: 2
Reputation: 1
I have closed the editor (Visual Studio) and I typed the usual commands:
git add .
git commit -m "Comment text"
git push -u origin master
This worked for me.
Upvotes: -5
Reputation: 1344
What I did was to run:
git rm -rf --cached myuntrackedfolder
This tells git to forget about it (since it was being tracked formally).
Then I used:
git add myuntrackedfolder
to add it and I was good to go.
Upvotes: 127