Work with Version Control like a boss in 5min

This is an absolute MUST to coordinate work of many people in a team, and guarantee code traceability. The most important benefits are:

  • Travel in time back-and-forth as many times as you want.
  • Get highlights of the precise lines that changed in each commit.
  • Manage parallel development of new features.

1 – Basic folder structure

Conventional uses for each folder:

  • Trunk : Standard Scenario.
  • Branches: Each feature is developed in a separate branch inside /branches.
  • Tags : Closed and tested versions (releases). Usually named and numbered.

2 – Commit

This is the basic, most useful, and most often used action in Version Control. It saves the current state of your code and gives it a Revision mark. The result is a history Log that you can check and click to travel in time:

Never leave the Message box empty. Your future you will thank you when trying to remember what each change meant.

This is rather philosophical  but it will become a no-brainer when you become a Version Control expert:

Always, ALWAYS commit!  –Someone who lost hours of work trying to undo some change.

There’s no need to wait for a working state in order to commit. Commit every change you make, better be safe than sorry.

3 – Branching

Additive development is carried in Trunk. When you want to implement a new feature with significant changes, or prepare an alternative Scenario, it’s time to branch.

The current work space in which you are at the time of branching will be the base for the new branch. You could create a new branch based on another branch.

 

4 – Switching between branches (or trunk)

The key for seamless switching is the first and most important motto in Version Control: always commit! Once everything is committed jumps will be effortless and almost magical.

The best analogy is jumping between parallel universes. Just click Switch, select the destination and all files will go to the state they have in that branch. Files no longer present will hide (don’t worry, they are still there!), and new ones will emerge.

 

5 – Merging

This is the final step after your feature is finished. Your modifications will be added to the trunk (or another branch). The tools included in version control save 90% of the time when compared to manual updates, and avoid 99,9% of the errors that would happen if you had to update changes manually.

*The Test merge feature is really useful. Click it, check that everything is to your liking or perform manual changes if you wish.

 

Click Merge and review the results. If it’s all right, go ahead and commit the merge to save the changes.

 

Bonus:

Very often you will find that you have started making changes in Trunk, but you feel those changes belong in a new branch. Luckily there’s a simple solution for that. Select > Branch, and tick these two options to create a new branch based on the same rev as your working copy, and also move the modifications to the new branch. This leaves the Trunk untouched.

 

As well as this short manual, it’s        

  • Version Control is implemented in many programs and extensions, all of which respect the same principles explained here. In Windows we prefer TortoiseSVN, in Linux there is RabbitVCS. Both are completely free to use even in a commercial environment.