Show Menu

Git-svn for Beginners Cheat Sheet by

The basic use cases for interacting with svn using git. (Based on )

Setting up a git svn working copy

Checkout standard repository
git svn clone -s svn-url local-dir
Reflect & track remote ignores
git svn show-i­gnore > .gitignore
Reflect remote ignores
git svn show-i­gnore >> .git/i­nfo­/ex­clude

Normal git workflow

Add file/stage changes (recur­sive)
git add file
Remove file
git rm [-r] file
Intera­ctively stage changes
git add -i
Revert unstaged changes
git checkout file
Revert staged changes
git reset HEAD file
Commit staged changes
git commit
Add and commit all changes
git commit -a

Working with branches

Create new branch
git branch new-branch [old-branch]
Move to a branch
git checkout branch
Create and move to new branch
git checkout -b new-branch [old-branch]
List local branches
git branch
List local and remote (svn) branches
git branch -a
Merging a branch to current branch
git merge other-­branch
Merge a branch as single commit
git merge --squash other-­branch

Updating from and committing to svn

Apply remote changes to local repo
git svn rebase
Commit changes back to Subversion
git svn dcommit


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Subversion Cheat Sheet
          Mercurial (Hg) Cheat Sheet
          Git Cheat Sheet