Kamran Ahmed
Kamran Ahmed

Reputation: 12438

Git : Files are not getting added to the staging area

I have copied an external folder containing some files to my repository

Added this new folder having content inside After that I run git status and it showed that in the modified files as expected

enter image description here

..I run the git add .

enter image description here

..it didn't show any errors. Then I run git status again to check if the files have been added to the staging area

enter image description here

Files weren't moved to the staging area. Why is it not moving this folder to the staging area? How may I move it to the staging area?

Upvotes: 2

Views: 1006

Answers (3)

Kamran Ahmed
Kamran Ahmed

Reputation: 12438

I didn't remember that it jobtest was a repository on it's own when I copied that into this repository of my own. I didn't want it as a submodule so I removed .git folder from it to make it an ordinary folder, added and commited and that's it. It all worked.

Upvotes: 1

Waldz
Waldz

Reputation: 104

Are You sure that directory jobtest contains files, because Git don't trac empty directories.

I You really need empty direcotry to be tracked, add at least one file jobtest/.gitignore with contents:

*
!.gitignore

Upvotes: 0

VonC
VonC

Reputation: 1323333

jobtest is a submodule, not a regular folder.

You need to:

  • go within jobtest, add, commit, push,
  • then go back to the parent repo, add, commit and push (recording the new gitlink which represents the SHA1 of the jobtest repo).

As I explained in "Git diff says subproject is dirty", to get a clean status (ignoring the submodule state), you would need:

git status --ignore-submodules=dirty

Upvotes: 1

Related Questions