Skip to content

Instantly share code, notes, and snippets.

@peff
Created August 13, 2010 14:44
Show Gist options
  • Save peff/522992 to your computer and use it in GitHub Desktop.
Save peff/522992 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Create a repo with non-linear history.
rm -rf repo
commit() {
echo "$2" >>$1 && git add $1 && git commit -m "$1: $2"
}
push() {
git push -f [email protected]:peff/svn-sandbox.git master
}
# Start with some base-line commits
mkdir repo && cd repo && git init &&
commit file one &&
commit file two &&
push &&
svn checkout http://svn.github.com/peff/svn-sandbox.git svn &&
git svn clone http://svn.github.com/peff/svn-sandbox.git git &&
# And then a trivial merge
commit file three &&
git checkout -b topic HEAD^ &&
commit other one &&
git checkout master &&
git merge topic &&
push &&
(cd svn && svn up) &&
(cd git && git svn fetch) &&
# And then one with conflicts
commit file four &&
git checkout -b another HEAD^ &&
commit file five &&
git checkout master &&
! git merge another &&
# resolve
cat >file <<EOF &&
one
two
three
four
five
EOF
git add file &&
git commit &&
push &&
(cd svn && svn up) &&
(cd git && git svn fetch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment