2

I am moving my php composer dependencies into a prebuilt repo, but for some reason some files are not being tracked when I push to the repo. To counteract this I am telling my repo to ignore any repos (dependencies) that are put into the parent folder via composer update.

How can I tell my main repo to ignore any repos that happen to be pulled in as folders.

I am currently using this in my .gitignore

#ignore all folders called .git
.git/

# Unignore the parent .git folder
!/.git/

I do not want any submodules. Only one repo with all the code versioned.

Jen Zhang
  • 1,248
  • 1
  • 11
  • 15

1 Answers1

0

Any nested repo would be ignored anyway, so you wouldn't have to add those gitignore rule.

If you need to "version" those nested repos, declare them as submodules, in order to record a SHA1 reference of said nested subrepo in the parent repo.
Then they can be populated with a:

git submodule update --init

If you want only one repo, then you would need to merge those sub-repos into the main one, before pushing everything.
See for instance: "How do you merge two git repositories?" (in particular this answer).

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • @JenZhang once added as submodule, they act as their own git repo, where all the files aren't ignored. If you modify one, you can commit within that submodule, and then go back to the parent module, add and commit there the new SHA1 reference of the submodule. More at http://stackoverflow.com/a/1979194/6309. – VonC Feb 01 '14 at 08:09
  • @JenZhang I have edited the answer for adding another clue: merging repos together. – VonC Feb 01 '14 at 08:40