Skip to content

Instantly share code, notes, and snippets.

@Asenar
Last active December 15, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Asenar/5246483 to your computer and use it in GitHub Desktop.
Save Asenar/5246483 to your computer and use it in GitHub Desktop.
mkdir ~/tmp_working_dir
cd ~/tmp_working_dir
git init full_smalte
cd full_smalte
all_subs="installer framework module.sample tests theme.backoffice theme.frontoffice"
# part 1 : import all
# Six branch doomed to die
for i in $all_subs; do
git remote add "${i/./-}"_origin https://github.com/Smalte/$i.git
done
git fetch --all
git checkout -b megamerge
# part 2 : one branch to govern them all
for i in $all_subs; do
# get theses datas
git merge ${i/./-}
# move them to the correct dir (can be improved)
mkdir ../${i/./-}
mv * ../${i/./-}/
mv ../${i/./-} ./
# this will handle all git add and git rm
git add .
git commit --m "imported $i"
done
git commit --allow-empty -m "all submodules imported into main repository"
# now removing old references
for i in $all_subs; do
git remote rm "${i/./-}"_origin
done
git remote add origin git@github.com:Smalte/Smalte
git push origin new_develop
@Asenar
Copy link
Author

Asenar commented Mar 26, 2013

Remarques:

  1. normalement le "." dans le nom ça doit fonctionner pour le nom des branches, mais c'est à vérifier
  2. git add . j'ai un doute, à vérifier aussi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment