Skip to content

Instantly share code, notes, and snippets.

@codereflection
Last active December 17, 2015 13:19
Show Gist options
  • Save codereflection/5616080 to your computer and use it in GitHub Desktop.
Save codereflection/5616080 to your computer and use it in GitHub Desktop.
# adapted from http://notes.jimlindley.com/2008/3/25/git-svn-that-works-for-me
# initial slow setup (this will scan all of the base svn repo's history, and could take hours)
# - Change <svn_repo> to the base url of your svn repo, WITHOUT trunk at the end
# this will point master to /trunk and allow you to point git branches to svn branches
git svn clone <svn_repo> --stdlayout
# initial quick clone setup
# - Change $REV to the first revision of your repo, i.e. 24903
# - Change <svn_repo> to the base url of your svn repo, WITHOUT trunk at the end
# this will point master to /trunk and allow you to point git branches to svn branches
git svn clone <svn_repo> --stdlayout -r$REV:HEAD
# begin the workflow
git svn fetch -r HEAD --ignore-paths="Package.zip" # aliased to 'git up', my Package.zip is very large.
git svn rebase -l # we just updated, no need to go back to the svn repo
# 99% of daily workflow
git checkout -b <work_branch>
# ----- hack loop
git add .
git commit -m <message>
# ---- hack loop end
# ---- or blow all of your pending changes away and start fresh
git reset --hard HEAD
git clean -f
# ----
# ----- update master loop from subversion
git checkout master
git svn rebase
# now that master is current with svn,
# sync working branch to local master
git checkout <work_branch>
git merge master # conflicts here: git mergetool -t tortoisemerge
# ----- update master loop end
# final upstream commit after rebasing
git checkout master
git svn rebase -l # one last check for new svn check ins
git merge <work_branch>
git svn dcommit -e # -e allows us to enter an svn commit message
git repack -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment