0

I'm using Git on Mac OS X. I have a folder at the root of my project (at the same level as the ".git" folder) and I want to add it so I tried

localhost:salesproject satishp$ git add -A myfolder1/
warning: CRLF will be replaced by LF in server.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in web/processor.js.
The file will have its original line endings in your working directory.

However when I ran

localhost:salesproject satishp$ git commit -m 'Some changes.'
warning: CRLF will be replaced by LF in server.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in web/processor.js.
The file will have its original line endings in your working directory.
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
    modified:   myfolder1 (modified content)

no changes added to commit

Despite the fact there were changes in this folder. Following this advice -- git add -A is not adding all modified files in directories , I tried this

localhost:salesproject satishp$ git submodule foreach --recursive git add -A .
Entering 'myfolder1'
No submodule mapping found in .gitmodules for path 'myfolder1'

but I still get the same error when I try and commit. How do I add my directory to my Git project?

Edit: Here's what happens when I run "git status"

localhost:salesproject satishp$ git status myfolder1/
warning: CRLF will be replaced by LF in server.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in web/processor.js.
The file will have its original line endings in your working directory.
On branch master
Your branch is up-to-date with 'origin/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:   myfolder1 (modified content)

no changes added to commit (use "git add" and/or "git commit -a")
satish
  • 703
  • 5
  • 23
  • 52
  • 1
    What is the content of `myfolder1`? What is the output of `git status` after `git add -A myfolder1`? – mkrieger1 May 14 '18 at 20:57
  • 'Despite the fact there were changes in this folder" How can there be changes if you haven't committed the folder before? Do you mean to say that it has content? – user229044 May 14 '18 at 21:00
  • @mkrieger1, I added the output in response to the "git status" command (executed after the git add -A command you recommended I run) – satish May 14 '18 at 21:16
  • you should be able to just add that particular folder with git i.e. : `git add myfolder1` ; also, supposing the folder isn't empty (if it's empty, that might be the reason, not sure about if you have hidden files in it). – Sanda May 14 '18 at 21:19
  • You issue might actually be this: `No submodule mapping found in .gitmodules for path 'myfolder1'` ; some articles I've found point to do an update / init of the git submodule `git submodule update --init` (do pls RTFM before using: https://git-scm.com/docs/git-submodule) ;then doing a `git rm --cached myfolder1`/ You should then be able to `git add myfolder1 ; git commit -m "etc"` – Sanda May 14 '18 at 21:34
  • @Sanda, THis last sequence -- starting with your "git rm --cached myfodler1") worked. – satish May 14 '18 at 21:44
  • happy to help :) – Sanda May 14 '18 at 21:46

1 Answers1

0

You issue might actually be this: No submodule mapping found in .gitmodules for path 'myfolder1'

  1. Some articles I've found point to do an update / init of the git submodule git submodule update --init (do pls RTFM before using: git-scm.com/docs/git-submodule);
  2. Then do a git rm --cached myfolder1

  3. You should then be able to git add myfolder1 ; git commit -m "etc"

(just transcribing the response from the comments)

Sanda
  • 1,357
  • 19
  • 29