Subversion Branch Merge Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to this assemble video tutorial in this video we'll be discussing how to use subversion branch and merge properly when you're working on a project and have a lot of changes to make but might not finish all those changes in one working day you still need to commit your work after all one of the golden rules of version control is checking often sticking to this rule gives you more flexibility in your projects but isn't always practical if you're always checking into the trunk because your code might only be partially complete this could break the project for your teammates and slow productivity until you've completed your changes that's why we have and should be using subversion branching when you branch you're taking a copy of the current trunk repository and copying it to another location so that you can safely and continuously check in your code without disturbing the others who are working on the project this allows you to commit half-finished code without breaking the current trunk that others are using to complete their work let's take a look at an example I've got a copy of a wordpress theme here that i want to make some changes to as you can see the project is already set up with the default top-level tags branches and trunk folder layout we're on a Windows machine so we're using and recommend you use tortoise SVN tortoise SVN integrates directly with your Windows Explorer and makes managing your SVN projects simple with right-click access to all the major SVN commands if you're not on Windows see our SVN client guide SVN RTF assembly comm and click on the client guide link at the top of the page you'll find the download link for tortoise SVN and the client guide as well so here's how we go about creating a branch there are two ways to do it the simplest and fastest is to right-click on your trunk and drag it to the branches folder when you let go you select SVN copy and rename version item here we're going to call it add theme widgets and then it will create those changes now before that shows up in your actual repository you're going to need to make commits once we've committed that change we simply want to create a new working be using the new repo URL for the ad theme widgets branch we now have an isolated working copy of the trunk to begin working with what we need to do next is where most people go wrong when branching and probably the source of more headaches red blocks and collaborative development horror stories and you can shake a stick at let's talk about keeping your branch up to date with the current head revision from the trunk doing this will save you a lot of trouble when you finish working on your branch and the time comes to integrate it back into the trunk and while it is important to keep your branch up to date with the most recent trunk revision this isn't something you'll need to do as much as say an SVN update unless you're running into a lot of major conflicts if you do this at the end of each day you should be just fine merging your trunk to your branch and vice versa is simple with tortoise SVN simply right-click inside the root of your branches working copy and select merge from the tortoise SVN menu we need to get the most recent revision of the trunk into our branch so we'll select the first option merge a range of revisions in the URL to merge from field we want to paste the URL for our trunk and the revision range to merge field let's take a look at our logs and go back to where we created our branch we created our branch at revision one so we're going to select ok and then type - head and what that will do is it will take all revisions since version 1 from the head and move them over into the into the branch and for the cautious you can click test merge and it completed successfully so if it completes successfully with no conflicts we then simply click merge we do the real thing and there we go but a being bada-boom we have a successfully merged working copy once the merge is complete we have a couple files that have changed since our last commit to our branch so we'll simply right click commit and click OK now let's talk about actually taking your branch once all the development work on that branch is completed and merging it back into the trunk now there is a couple of steps that are considered best practices to do we're going to go through all of those before we actually do the merge first things first go into your branch and make sure that you've committed all of the changes you've made then after you've made those commits what you want to do is run another merge from your trunk into your branch which is done from the tortoise SVN menu select merge merge a range of revisions the URL to your trunk the revision range and we'll just again go from revision 1 to the head click Next test merge and then run the merge itself and once we've done that we're going to jump over to our main project folder and we're going to make sure we have the most recent revision of the trunk already checked out so we'll just run a quick SVN update and there we have it now we're going to go inside of our trunk and right click and select merge and then we're going to select this time to reintegrate a branch option we'll click Next the URL this time is not going to be our trunk but our actual branch select next test merge as you can see the test merge completed without any errors so now we're actually ready to perform the merge itself once that's completed you click OK that is about it for this tutorial if you'd like to grab a free 30-day trial of assemblee subversion hosting with tickets please head over to offers assembly comm forward slash subversion and check us out you can also check out our essential guide to subversion at SVN Rev assembly comm where we have tons of great tutorials and SVN client guide to help you choose the right client for you as well as server download and installation instructions for all major platforms you can also follow us on twitter at twitter.com/usembassymanila
Info
Channel: AssemblaVideo
Views: 142,633
Rating: 4.5465117 out of 5
Keywords: subversion, svn, scm, version control, branch, merge
Id: 4WC44T89VrY
Channel Id: undefined
Length: 7min 10sec (430 seconds)
Published: Thu Jan 07 2010
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.