Skip to content

Instantly share code, notes, and snippets.

@radmen
Forked from smgoller/gist:1171102
Created April 4, 2012 12:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radmen/2300725 to your computer and use it in GitHub Desktop.
Save radmen/2300725 to your computer and use it in GitHub Desktop.
git svn workflow
# adapted from http://notes.jimlindley.com/2008/3/25/git-svn-that-works-for-me
# initial setup
git svn init <svn_repo>
git svn fetch -r HEAD
# alternate way - when there's need to use branches etc
git svn clone --trunk=devel --branches=branches -r NUM <svn_repo> # NUM is one of the latest revisions
git svn fetch
# alternate way - END
git svn show-ignore | sed '/^$/d' | sed '/^#/d' > .gitignore # watchout it's extremely slow
git add .gitignore
git commit -m "Added gitignore"
git svn dcommit # push changes to repo
# begin the workflow
git svn fetch -r HEAD # aliased to 'git up'
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 -a -m <message>
# ---- hack loop end
# ----- update master loop
git checkout master
git up
git svn rebase -l
# now that master is current with svn,
# sync working branch to local master
git checkout <work_branch>
git rebase master # conflicts here: git mergetool -t tortoisemerge
# ----- update master loop end
# final upstream commit after rebasing
git checkout master
git up
git svn rebase -l # one last check for new svn check ins
git merge --squash <work_branch>
git commit
git svn dcommit
git repack -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment