Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

closed as off-topic by Bart van Ingen Schenau, MichaelT, amon, jwenting, GlenH7 May 1 '14 at 14:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Bart van Ingen Schenau, MichaelT, amon, jwenting, GlenH7
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
In short: a) there is no index, b) svn up = git pull, c) svn commit = git commit && git push d) branches are emulated by directories ... ;-) –  johannes May 1 '14 at 13:26
1  
I'm not sure how I can make this more on topic... –  agent154 May 1 '14 at 14:19
3  
No way. Next to anything is offtopic on P.SE. –  JensG May 1 '14 at 15:42
    
@agent154 don't ask for us to be a crowd sourced search engine for you. Identify the problem you are having - the problem isn't "where can I find things on svn" its "I am trying to do something, and I can't figure out how to do it." If that something is specific to the command 'svn' and you are working on the way to write it, ask on Stack Overflow. If that something is about the workflow and organization of svn (when to branch, when to merge, how to work with other developers) - then ask it here. –  MichaelT May 1 '14 at 16:33
    
I think the problem identified is a lack of resources even somewhat-remotely-readily available for understanding SVN as a Git user. Frankly, I'd find a discussion on this super useful after having poured through several pages of Google/DuckDuckGo results not finding anything other than what the OP mentioned. –  Metagrapher Oct 27 '14 at 18:20

2 Answers 2

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.

share|improve this answer
    
Depends. Merging with SVN becomes bad, when files have been moved (which is essentially an educated form of delete+add managed by SVN itself) by someone AND changed by someone else. Other than that, nice answer. –  JensG May 1 '14 at 15:45
1  
I did mention the tree conflict issue... Such a state is a problem for other scms, though I understand git uses a heuristic to detect if the moved file is the same one, it can still get it wrong if the changes are significant (eg the file being split into 2). –  gbjbaanb May 1 '14 at 22:57
    
Git doesn't need heuristics for detecting tree changes - it needs the user to move the file with git mv. SVN has svn move, but since branching and merging in SVN is kind of a hack, I don't believe it can automatically solve tree conflicts like git does... –  Idan Arye May 1 '14 at 23:43
2  
@IdanArye git mv is implemented as add+remove. git uses heuristics to determine if a move or copy took place during a commit (I think the default is, "is 80%+ of the file the same?") –  Izkata May 2 '14 at 0:51

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).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.