Skip to content

Instantly share code, notes, and snippets.

@fiedl
Last active December 30, 2015 21:49
Show Gist options
  • Save fiedl/7889777 to your computer and use it in GitHub Desktop.
Save fiedl/7889777 to your computer and use it in GitHub Desktop.
A small Subversion guide for Git users. Forked from http://blog.tfnico.com/2011/02/small-subversion-guide-for-git-users.html.

A small Subversion guide for Git users

(Forked from http://blog.tfnico.com/2011/02/small-subversion-guide-for-git-users.html.)

A recurring problem for us Git users is that we tend to forget the good old Subversion tricks. We want to do some patch on some old code in a Subversion repo, and suddenly we've got no idea how to work around.

Here's a quick guide:

> git pull
> svn update


> git add new_file
> svn add new_file

> git add changed_file
N/A: SVN automatically adds all modifications to the index. If you don't want to commit it, don't change it.

> git commit; git push (you always have to do these together):
> svn commit

> git revert [SHA]
> svn merge -c -[R] .


> git branch branch_name
> svn copy url_to_project/trunk url_to_project/branches/branch_name


> git tag tag_name
> svn copy url_to_project/trunk url_to_project/tags/tag_name


> git checkout branch_name
> svn switch url_to_project/branches/branch_name/


> git merge branch 
svn merge -r[start]:[end] url_to_project/branches/branch_name .
(Note that you have to keep track of at which revision you made the branch, and that the result will always be squashed. Renames and moves will create conflicts).

> git rebase ...
Forget about it :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment