No idea why this is happening:
git status On branch master 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: file (modified content) no changes added to commit (use "git add" and/or "git commit -a") starkers@ubuntu:~/Documents/currentWork/protection_demo$ git add --all starkers@ubuntu:~/Documents/currentWork/protection_demo$ git status On branch master 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: file (modified content)
No matter what I do, git commit -am
, git commit -a
the file will not be added to the commit. Any help?
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. We also say that they will be staged.
To add and commit files to a Git repository Create your new files or edit existing files in your local project directory. Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed.
I think maybe Jubobs' comment is correct. Is your "file" a submodule?
This line (commit or discard the untracked or modified content in submodules) should not appear for normal files.
Here is what I get from git status:
$ git status On branch master 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) modified: README.txt no changes added to commit (use "git add" and/or "git commit -a")
You will not see (commit or discard the untracked or modified content in submodules) and (modified content) after my README.txt
So you may need to do what git recommended, work on the content in submodules.
Edit: Previously I thought the "git add ." could solve the issue but now I think it could not.
I had this same problem. My personal "aha" was that I had previously added a tracking .git repository file to a subfolder and thus it was seen as a submodule. After removing the .git in the subfolder, it happily joined the rest of my folders as part of just one .git file in the root folder. I didn't even know about submodules so maybe this will help someone as well.
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