So I took a job where the firm uses SVN (but will be moving to Git sometime in the future). The problem is that I don’t know SVN. I’ve tried numerous Google queries and all I can ever find are SVN->Git tutorials, “Why is Git better than SVN” blogs, and a particular “cheat sheet” that gives (some) comparable commands…
Short of reading the O’Reilly book on SVN, what are the brief (but not too brief) instructions to SVN for Git users?
5
The canonical reference is the Subversion RedBook. Regardless of your past skills, read this from fresh and you’ll get all the usage information you need. Its not difficult or completely alien, most people say SVN is a lot easier to understand than git so you should be fine with just a little bit of reading the main commands. The basic usage chapter should get you up and running without problem.
There are 2 main differences:
- commit = push to central repo. There is no rebase or local commit, no pulls either.
- branching is by directory. Best to think of the entire repo as a directory structure, branching is like making a symlink with copy-on-write semantics. Whereas in git you branch the entire repo and switch between them so the new branch ‘overlays’ your working copy, with SVN you can swap pieces of your repo out. Generally people branch on a top-level folder (usually called branches) so switching becomes much more like git’s ‘overlay’ style of working.
Branching is trivial, merging is nowhere near as bad as DVCS apologists want to make out, especially if you stick to the “standard” trio of top-level folders (called trunk, branches and tags).
There are a few bits that SVN beats git in, sparse directories comes to mind – where you checkout only part of your repo. When you need more parts, you update only what you need. If you have a huge repo (eg a core product and loads of plugins) this is brilliant.
There are a few bits that are not as good as git, the dreaded tree conflict comes to mind – where you have a conflict at directory level (ie someone’s deleted a file you’ve edited)
If you’re on Windows, use TortoiseSVN. It rocks majorly.
4
Use git svn if possible. I have been in your situation and after half a year of frustration I switched to git svn and have been happy since then.
Git svn lets you use the repository locally and committing to the SVN server is then handled by a git svn rebase
which rebases your local changes onto the subversion trunk and then git svn dcommit
which commits the rebased commits.
Maybe it is not optimal for advanced Subversion usage, but since you are using git locally everything is fine.
When using git clone you should not clone the subversion root folder but your target directory directly (clone trunk
). This will make git run a lot faster, otherwise your working copy can become huge.
Disclaimer: I do not know how the situation is when you want to create Subversion branches, etc. The teams I worked with did not use branches (just me local git branches).