Skip to content

Instantly share code, notes, and snippets.

@eirenik0
Created August 11, 2022 11:04
Show Gist options
  • Save eirenik0/3be5bfd6b6b63039d53ac2f99664dde5 to your computer and use it in GitHub Desktop.
Save eirenik0/3be5bfd6b6b63039d53ac2f99664dde5 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [[ $# -ne 2 ]] ; then
echo "Usage: git-split.sh original copy"
exit 0
fi
git mv $1 $2
git commit -n -m "Split history $1 to $2"
REV=`git rev-parse HEAD`
git reset --hard HEAD^
git mv $1 temp
git commit -n -m "Split history $1 to $2"
git merge $REV
git commit -a -n -m "Split history $1 to $2"
git mv temp $1
git commit -n -m "Split history $1 to $2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment