Easy way to create repo with submodules from folder containing git repos as subfolders

0

My case is ~/Library/Application Support/TextMate/Pristine Copy/Bundles there I have some bundles/folders which are all git repos. If I create git repo at Bundles folder, which will be the easiest/fastest way to add all bundles as submodules to this repo?

tig

Posted 2011-03-26T21:19:58.923

Reputation: 3 906

Answers

0

Got it working this way:

git init
for f in */**/.git; do
  git submodule add "$(git --git-dir="$f" config remote.origin.url)" "$(dirname "$f")"
done

tig

Posted 2011-03-26T21:19:58.923

Reputation: 3 906

0

git init
for f in *; do
    [[ -d $f ]] && git submodule add "./$f" "$f"
done

user1686

Posted 2011-03-26T21:19:58.923

Reputation: 283 655

Got remote (origin) does not have a url defined in .git/config for every repository. As I understand relative form for repository assumes that all repos are in one location, but this is not my case. – tig – 2011-03-26T23:22:32.703