Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "modified content, untracked content" in git?

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 
like image 520
Ayush Avatar asked May 04 '18 05:05

Ayush


People also ask

How do I fix modified content untracked content?

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!!!

How to add untracked content git?

The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area.

How to remove modified content in git?

If you have modified, added and committed changes to a file, and want to undo those changes, then you can again use git reset HEAD~ to undo your commit. Similar to the previous example, when you use git reset the modifications will be unstaged. Notice that now your file is no longer being tracked!

What is git submodule update?

A git submodule update will bring the latest commits into your local Git worktree. In this git submodule update example, we'll show you how branches can seem out of sync between your submodule and the latest commit, and how to issue the appropriate git command to update those git submodules with the latest code.


1 Answers

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.

like image 75
xplorer1 Avatar answered Sep 20 '22 17:09

xplorer1