Branches, Tags, and a nice Trunk. in Tutorials & Snippets
|
|
At one point or another, you'll have likely heard of this voodoo called SVN. SVN is something that allows group collaboration to happen in a structured atmosphere, creating a union between different versions of code, and an overall easy way for developers to work on different parts of a project, and gracefully merge them together without having to go through the trouble of having one guy sit alone in his home office for 8 hours reading over every line of code looking for conflicts. Don't worry, even if you're going at a project alone, SVN can be very useful to you for backing up your data, so read ahead.
What I'm here to explain however isn't how SVN works as a whole, but rather how the branch/tags/trunk structure works, and how you can utilize it to make sure you always have good working copies of your code readily available. What you don't want to find is that you've completely muddled up your code, and you can't figure out how to backtrack to the last working copy you had. That's where SVN comes in.
We're going to start of first with the branch. You can think of this like your workshop. This is where you'll want to start leaving your project between times you're working on it for simple backup purposes, and to show other developers what you are working on. You'll be working mostly from in here, so you'll likely have a couple folders and a bunch of random scraps of coding. This is normal. Once you get to a point where you compile your code, you run it, it seems to work okay, everything checks out. Maybe not all of the features work yet, but it is functioning without any errors at compile or run time. Time to move onto the next step. Tag it, and bag it.
Now that you have a working copy of your program, you're going to want to stamp it as a working version for future reference, a way for you to say that you've got a working copy, and if everything quite literally hits the fan, you can jump back to this version and know that you're starting on solid footing. Here is where you're going to want to commit what you have to the tags as a version number, like ProjectName v0.01 so you have some kind of incentive to what it is, as well as the repository(SVN) will order them by the number.
Once you've completed that step, you're going to want to commit it once again into the trunk. The trunk is your most recent working copy of the program. While you may have many tags of the program working for different versions, the trunk will always contain the most recent up to date working copy. Giving a new developer a good starting point to jump into the project, as they'll have the most recent copy to start from.
In short, to sum up what the previous paragraphs have just said, The most common SVN structure is the branch, tags, and trunk method. Branches are where your in development code is for the project. Tags are where version numbers of your working copies of the program go, and the trunk is where your most recent copy of the program in a working state goes. You can always download the trunk for the most recent working copy, or grab an older working version from the tags.
Using this method should greatly help you to keep your project managed, and greatly prevent you from losing your project, or ending up with an unrepairable copy. As well as making a group project a lot easier to maintain, from the prevention of one members code overwriting another.
I hope this helps you, and perhaps steers you towards using SVN in the future. I started using it, and have loved it ever since. Thanks for reading.
|