1

How do you add git revisioned files to a different git?

Current Setup:

env/A.txt
env/.git         <-- parent git

env/docs
env/docs/B.txt
env/docs/.git    <-- child git

While inside env directory I want to be able to add all files to parent git including the ones from child git. For some reason I am not able to do that. All files that are inside env/docs/B.txt are not adding to parent git. What to do?

Ura718
  • 371
  • 2
  • 6
  • 13

1 Answers1

1

For some reason I am not able to do that

That is expected: docs is considered a nested Git repository, and only its root tree SHA1 would be recorded, as a gitlink.
It is not a submodule, not unless you have a .gitmodules at the root of your parent repo, referencing docs/.

You would need first to remove the gitlink if you already added it: see "Nested GIT Repository mistake method to remove it?"

Then one solution is to add the docs remote repo as a submodule.
But if you don't care about the history of those files, the other approach would be to move or remove the docs/.git folder: that would make docs/ a regular subfolder, that you can add and commits from its parent folder envs/.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250