Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
git init
for f in *; do
    [[ -d $f ]] && git submodule add "./$f" "$f"
done
share|improve this answer
    
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 Mar 26 '11 at 23:22
up vote 0 down vote accepted

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
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .