简体   繁体   中英

How to disable submodules functionality for git repo with nested git repos?

I have following repo structure:

/repo
  .git/
  subrepo1/
    .git/
    ...
  dir/
    subrepo2/
      .git/
      ...
  ...
  subrepoN/
    .git/
    ...

subrepo s are updated externally, but don't necessarily have a remote. repo 's purpose is to track all subrepo 's updates and introduce new changes in a single place. Updates will form a "vanilla" branch inside repo , which then will be periodically merged to "dev" branch. That's the intended workflow. Git by default refuses to track subrepo 's files, assuming they are non-configured submodules.

Questions is how do I disable such behaviour? I don't want to use submodules. I want Git to stop treating subrepo s as submodules, ignore every subrepo 's .git directory while keeping it, and to track all files from subrepo s. Preferably in repo 's .git/config file.

I looked through git manual, tried various things and couldn't acheive this. There is a valueable workaround , but it still requires to execute git add <subrepo-path>/ for each subrepo . Subtree approach isn't desireable, because it seemingly doubles space consumed and adds complexity.

I don't think there is a simple way. Either you have to remove or rename .git/ in subfolders or edit git sources (and recompile git) to disable recognition of .git/ as submodules.

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