Skip to content

Instantly share code, notes, and snippets.

@johnnyjung
Created May 24, 2012 22:42
Show Gist options
  • Save johnnyjung/2784661 to your computer and use it in GitHub Desktop.
Save johnnyjung/2784661 to your computer and use it in GitHub Desktop.
SVN with Git Cheat Sheet
### Using git with a SVN server/repo
Sources
http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion
http://viget.com/extend/effectively-using-git-with-subversion
git svn clone -s <url> <local_dir_name>
# setting up
git checkout -b <feature_branch>
git add .
git commit -m " "
git checkout master
git merge <feature_branch>
# workflow
git svn branch <feature_branch>
git branch <feature_branch> <remotes/features_branch>
git checkout master
git merge <feature_branch> -m "Message"
# SVN branch workflow
git checkout -- <file_name> # to unmodify
git reset HEAD <file_name> # to unstage
# reverting changes before commit
git svn rebase
# pulls changes from svn server
git svn dcommit
# commits to subversion (i.e. push to remote)
git stash
git stash apply
# stash workflow #1
git stash save "Message"
git stash list
git stash pop
# stash workflow #2
git svn log
NOTE on SVN Branches:
# Running dcommit on a branch with merged history works fine, except that when you look at your Git project history, it hasn’t rewritten either of the commits you made on the experiment branch — instead, all those changes appear in the SVN version of the single merge commit.
# Branching in Subversion isn’t the same as branching in Git; if you can avoid using it much, that’s probably best. However, you can create and commit to branches in Subversion using git svn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment