Created
December 26, 2017 15:06
-
-
Save detunized/2fe8f46d6a7b2c696010bc617f76bf8f to your computer and use it in GitHub Desktop.
Join a bunch of repos into subfolders and rewrite the history to reflect where the commits are coming from
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Clone repos locally into original/ | |
( | |
mkdir original | |
cd original | |
git clone [email protected]:detunized/lastpass-sharp.git | |
git clone [email protected]:detunized/1password-sharp.git | |
git clone [email protected]:detunized/truekey-sharp.git | |
git clone [email protected]:detunized/dashlane-sharp.git | |
git clone [email protected]:detunized/roboform-sharp.git | |
git clone [email protected]:detunized/stickypassword-sharp.git | |
git clone [email protected]:detunized/zoho-vault-sharp.git | |
) | |
# LastPass repo has committer messed up in some commits | |
( | |
cd original/lastpass-sharp | |
# Fix up the committer/author | |
git filter-branch -f --env-filter ' | |
export GIT_COMMITTER_NAME="Dmitry Yakimenko" | |
export GIT_COMMITTER_EMAIL="[email protected]" | |
export GIT_AUTHOR_NAME="Dmitry Yakimenko" | |
export GIT_AUTHOR_EMAIL="[email protected]" | |
' -- --all | |
) | |
# Join all the repos | |
( | |
cat >list-of-repos <<EOT | |
lastpass original/lastpass-sharp | |
dashlane original/dashlane-sharp | |
zohovault original/zoho-vault-sharp | |
stickypassword original/stickypassword-sharp | |
truekey original/truekey-sharp | |
1password original/1password-sharp | |
roboform original/roboform-sharp | |
EOT | |
# Join | |
curl -s https://raw.githubusercontent.com/Oakleon/git-join-repos/master/git-join-repos \ | |
| bash /dev/stdin list-of-repos | |
rm list-of-repos | |
git gc --aggressive | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment