简体   繁体   中英

Tell git to ignore any repos in my main repo

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.

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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM