SVN 101

Let’s start with the basics. I’m assuming you know what svn is and the purpose for it. If not, use Google. This tutorial is to get you going with it. I’m assuming you have it installed and are working on a mac.

UPDATE:

There’s an easier way to structure your project (sorry, I’m learning as I go here…)

Pretty simple, you’re going to create a place to put your repos, populate them, then checkout a working copy:

 

For those of you who want a simpler step by step version, see below:

Set up your test environment:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”mkdir%20~%2FLearning%0Acd%20~%2FLearning%0Amkdir%20rawfiles%0Atouch%20rawfiles%2Fstuff.txt”/]

First step is to create a local repository (I’m assuming we don’t want to make this first tutorial more complex than it needs to be…usually your repo lives on a remote server where people can get access, but we are going to work with everything locally to keep it easy):

Create a repo:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”svnadmin%20create%20remote”/]

Import your files:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”svn%20import%20rawfiles%20file%3A%2F%2F%2FUsers%2F%7BYOUR_NAME%7D%2FLearning%2Fremote%2Ftrunk%20-m%20%22initial%20import%22″/]

Now we assume the “remote” is our repo living on a server somewhere. Time to pull down the project so we can start working with it:

Checkout a working copy:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”mkdir%20local%0Asvn%20co%20file%3A%2F%2F%2FUsers%2F%7BNAME%7D%2FLearning%2Fremote%2Ftrunk%20local%2Ftrunk”/]

Let’s see what we have in there:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual” manual=”ls%20-la%20local%2Ftrunk”/]

“Trunk” is just the main repository. It’s common in svn to use trunk the same way someone might use “Master” in git. It’s the production version of things. Not required, but it is convention.

At this point you’re ready to begin working with the files. In 102, I’ll show you how to setup your project to ignore certain files and begin modifications and commits. Then we’ll create some branches and start merging!

Conflict resolution:

Let’s say you get some while working with your branch. I’ll show how to resolve each situation and why they are occuring in the first place.


Local delete, incoming dir edit/delete

local missing or deleted or moved away, incoming dir edit upon merge

These types of conflicts (usually something called a tree conflict) happen when you have removed a directory locally, but there are property changes coming from another branch/trunk on the same directory. Ask yourself the following:

Am I sure these folders are supposed to be deleted?

If you are, then it’s safe to resolve the conflicts in the following ways:

[pastacode lang=”bash” manual=”svn%20resolve%20–accept%3Dworking%20%2FPATH%2FTO%2FFOLDER” message=”” highlight=”” provider=”manual”/]

This will tell svn “hey I’ve resolved everything manually, just take the changes I have locally.”

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.