Created
November 16, 2021 08:55
-
-
Save naliferopoulos/63d80a747c33a9c12a7f003ea649f2c7 to your computer and use it in GitHub Desktop.
Unravel a git repository in multiple ones in a historical fashion
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 | |
# Example: ./unravel.sh myrepo | |
REPO=$1 | |
BRANCH="master" | |
count=0 | |
pushd $REPO | |
for commit in $(git rev-list $BRANCH | tail -r) | |
do | |
popd | |
newrepo="$count-$commit" | |
cp -r $REPO $newrepo | |
pushd $newrepo | |
git reset $commit | |
git checkout $BRANCH . | |
$rebasecount=$count+1 | |
git rebase HEAD~$rebasecount | |
git commit --amend --date=now | |
popd | |
(( count++ )) | |
pushd $REPO | |
done | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment