Simple Version Control with TortoiseSVN – Part 2

Today we continue our little journey into Version Control and TortoiseSVN. We’ll talk about its practical uses and start branching and tagging. If you need a quick refresh, take a look at this Version Control guide. The terms that should interest us most are: Working Set/Working Copy, Trunk/Main, Revision, Check out, Check in/Commit, Branch, Tagging and Merge.

Revision Graph

We now have a project in our TortoiseSVN system. We have saved our work each day by committing the project folder. Today, for some very important reason, we need to forget what we’ve done and get back to the version of the project we had two days ago. Easy thing – right-click on your project folder and then TortoiseSVN, Revision graph. We should see something resembling this image, a graph with application versions and branches. Right-click on a specific box in there, then show log if we want to see the history of the revisions. Did we make up our minds about what revision we want? Right-click on its box and select Switch WC to path and revision. This will update our working copy to that specific version, meaning all the current files will be replaced with those from that specific version.

Branching

We now want to make a branch for some investigations on a feature or some other important reason. Right-click on our project folder, select TortoiseSVN, Branch/Tag, a dialog is displayed, we choose the place where we want this to be saved in the Repository – the To URL targeting the branches folder in our Repository and there a specific folder name identifying this branch (the folder will be created this way), like in this picture. We must also fill the log message describing what will contain this branch. Also we can choose if we want to start in this branch with the initial version from the main project, the current version loaded in the working copy or another specific version. Our Revision Graph should look like this. We commit our changes on a branch exactly like we do when committing on the trunk.

Update

From time to time we should make sure that our working copy has the latest updates from all the people involved in the project. Maybe the graphic designer changed some pictures or some other developer finished some module of the project. Just right-click on the project folder, TortoiseSVN, update. The status of the update will be displayed and you’ll see all the files – updated, added, merged and even conflicted. A special attention should be given to the conflicted files, the files which were changed by us and also by someone else in their work.

Merge

We have worked on a branch implementing some features. We want to return on main line for everyone to be able to use our work. Switch the working copy to the trunk (main line), right-click on the project folder, TortoiseSVN, Merge, and follow the intuitive Merge Wizard… In the From URL field be careful to target the folder from the Repository (in branches folder) where the branch is saved.

Lock

Now we want to be sure we are the only ones that are working on a file or folder. Quite easy to accomplish – select the files, right-click, TortoiseSVN, Get Lock and enter a comment that will be seen by the others if they try saving their work over your locked files.

Tagging

We have a first release of out project. We can mark all the files that should correctly compose this revision in a way that whenever we want it (or the customer, or some independent team) we can retrieve it easily. This is done exactly like the branching above, except that the target URL should be placed in the tags folder from the Repository and will probably have a suggestive name like “Release1.0”, “Candidate1.6”, etc. Remember, putting a tag is like taking a picture of the project, it should not be used for development like branches. It is simply there to be able later just to check out that specific version in another folder and test it or giving it to the customer.

Conclusion

I think TortoiseSVN is a smart solution if you want to use (and learn)Version Control on small projects. I hope this little tutorial with the basics gave you a start into this and if you want to learn more check out the official TortoiseSVN documentation page.

Images

Revision Graph

Revision Graph

Branching

Branching

Revision Graph 2

Revision Graph 2

Leave a Reply