How to fix "modified content, untracked content" in git?
Solution 1:
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.
Solution 2:
Remove .git from subfolders. This works for me.
Solution 3:
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:
- Remove .git/ from log4cplus and ../lib/notification/cppzmq.
- From parent directory from where you initialized your git repository, run the command:
git rm -rf --cached log4cplus/ && git rm -rf --cached ../lib/notifications/cppzmq
- Add and commit the directories to your branch again.
- Push to your branch.
Happy coding.
Solution 4:
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)