git svn - the simple guide

a simple guide of git svn. no deep shit ;)

Tweet

by garfee
inspired by Roger Dudler's git guide
this guide in 中文 is coming soon,
please report issues on github

preface

This guide is just for the people who can't abandon subversion but still want to benifit from git.
If you have no idea about git, this git guide can help.

checkout a svn repo

Checkout a svn repository by running the command
git svn clone <svn_repo_url>

For the repo in standard layout, which has trunk, branches and tags sub-dirs, use
git svn clone -s <svn_repo_url>

add & commit locally

Here we can work on local git repository and add changes to Staging Area by
git add <filename>
And then commit changes by
git commit -m "Commit message"
Now all changes are commited to local git repo, but not in remote svn repo yet.

commit to svn

Remember that, we used to run svn up before svn ci, in case of confilt.

Similarly before commiting to svn, launch
git svn rebase
This will pull down all changes in svn server, and patch your local changes to it

Now we can push changes to remote svn repo. Launch the commit
git svn dcommit

branching to svn

To create a svn branch, we can use
git svn branch <branch_name>
New branches will be created under branches directory, if specified -s in git svn clone

Then create a local working branch by running
git branch branch_name remotes/branch_name
Now we can work in this branch and svn dcommit/svn rebase will effect the remote svn branch

tagging to svn

To create a svn tag, we can use
git svn tag <tag_name>
The same as branching, new tags will be created under tags directory.

resources

comments

comments powered by Disqus