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
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!!!
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.
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!
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With