TortoiseSVN Branch/Merge Workflow Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right so what I'm going to show you today is a branch and merge workflow using tortoise SVN which is a subversion client which integrates with Windows Explorer as a shell extension that means that this in order to use it you would just need to right-click and now on the context menu of Windows you have a few different options for using subversion so let's go ahead and get started in Windows Explorer pick a location I have a dev space which contains all of my development projects and I will go to SBN check out here by right-clicking put in the location of my repository that looks good except instead of checking out the entire repository what I would like to do is I would like to check out just the branch that I need in this case I want to check out trunk and you can optionally give the local file or a local directory a different name I'm going to call this tortoise okay that looks good so on the first run after you hit okay it's downloading everything that is in whatever branch you're on in the repository in this case its trunk this is downloading the entire history of files so it does take a while to complete subsequent runs will take much less time though so if you think things are you know taking a long time to complete the rest assured it does get better the more you do it alright so we are at revision 61 as you see in the dialog I can go ahead and hit OK and dismiss that now in Windows Explorer if you notice the tortoise directory has a checkmark by it and that is tortoise SVN way of letting you know that this particular directory is under source control so in order to edit the file so say you have some edits to perform you don't want to do the edits on trunk you actually want to be on a branch either a staging branch or a development branch so let's go ahead and switch off a trunk by right-clicking on the folder and going to tortoise SVN switch and we have here two paths if you don't know the repository location you can hit this horizontal ellipsis here and that will bring up a dialog box but I happen to know it is at branches slash staging and that looks good I'll go ahead and hit OK here and now it still says I'm at revision 61 but I should be checked out if I right click here and go to tortoise SVN and I'll head switch I won't actually switch to anything else but you notice my source URL says branches staging which is exactly where I'm hoping it to be so now we can go into this project and before you do any edits what you actually want to do is you want to merge all the changes from trunk into your staging branch so you can rest assured that everything is the exact same when you start your development so I'll go over here in Windows Explorer and I will right click and hit tortoise SVN and I'm gonna select merge the option I want is merge a range of revisions I hit next and I want to merge trunk which is pre-selected for me into the current branch which my working copy happens to be on the staging branch I'll leave it at specific range however I will leave this blank just because tortoise SVN is smart enough to know that if this is blank it will automatically merge any revisions that have not been merged previously hit next here and finally hit merge so this will perform the merge operation from trunk into my working copy all right so that merge operation is complete I'll hit Oh Kenny here now as you notice over here in Windows Explorer it puts a little red circle by the tortoise icon that lets you know that something's changed so while no files have changed and we didn't see any files that were have been updated for a trunk that were not in staging there are hidden properties in subversion so those record each merge that has been performed over the life of the repository and that is why the change icon has appeared for you here so I will go ahead and in order to get those changes into my repository or record the merge I will hit SVN commit and I will say merged changes from trunk into staging and you see as I mentioned it says property change only it doesn't have any files listed so I hit OK my file is committed it's now a revision 62 and I'll select ok now we are ready to begin our edits just as you would if you were making a small change to the site so what I'll do is I'll just go ahead and I will pick any file here I don't usually use notepad plus plus but it does open up pretty quickly so for demonstration it does work pretty well I will come in here and I will add a comment and I will save that there's my glorious edit there and you can see image PHP has that same change icon that you saw when we did the merge as does every other directory in that file path so I'll go ahead and I find it's best to actually do a commit on the containing project so that way if there's any hidden properties it will update those as well so go to tortoise SVN and I'm sorry I will commit real quick and I will say added comment hit OK and now the change icon goes away our change is done on staging so now we need to get that change into trunk so we can deploy it to our production server in order to do that there's a couple steps you need to follow the first thing that you need to do is you need to merge trunk down into the staging branch again so you did it at the very start of your edits and now you're doing it as you're finalizing your edits and getting ready to bring your code back into production so I will right click go to tortoise SVN and before I actually do anything additional I'm gonna run an SVN update and what this does is sometimes when you commit the hidden properties in subversion don't automatically increment to the next revision so this gets all the counters in the same place so it'll allow you to do the merge operation if you ever see a notification that says you know cannot commit mixed revision try an update that's all you need to do in tortoise SVN is go over here right click and select SP n update so I'm in good shape here I'm in revision 63 I'll go back over right-click and I am going to merge one more time merger range of revisions that looks good trunk specific range we can leave blank hit next and merge okay so now we need to commit again so right click select SBN commit and we should have a record of our previous commit message in there which still applies to this gonna hit OK alright so now we need to switch to trunk so we can bring the changes that we made in staging into that and deploy to our production server the way to do that is we right-click on the file or the directory for our project rather and we're going to go to tortoise SVN switch and we're gonna change this path to drunk hit ok and that's gonna switch from staging to trunk where it revisions 64 so now the way to check is you can go into tortoise SVN and hit switch real quick we're not going to hit OK will actually cancel out of this but you do want to verify that your source URL is where you're expecting it to be so it's on trunk that's what I want and I'll go ahead and close out of that now we are going to right click and merge merge a range of revisions I'm sorry about that okay so merger Ranger her visions and then we are going to say branches staging and then we can hit next everything looks good there and we can hit merge now this tutorial does assume that you're using tortoise SVN that was compiled against the subversion 1.8 or greater binary if not your merge operation would have had to have specified that was this is supposed to be a reintegrate merge however with the introduction of subversion 1.8 it does it for you automatically and it's smart enough to know whether a merge should just be a regular merge or if it should be a reintegrate merge so I'll go ahead and I will commit here and you notice our file that had been updated on the staging branch is now in our working copy the property of tortoise the directory has been changed that recorded our merge operations so I am going to say reintegrate reintegrated staging in the trunk add it comment and if I'm a hundred percent comfortable with my change here what I can do is I can add a deployment flag which says to the subversion provider I want all these files to go to my production server and the way to do that is in square brackets you type deploy colon production and you close the square bracket hit okay and just like that all the files should be live on the production server in a matter of seconds without ever having to touch an FTP client that is all there is to it thanks guys
Info
Channel: Ethan Gardner
Views: 97,055
Rating: 4.6582913 out of 5
Keywords: TortoiseSVN (Software)
Id: uMVpD2t-QyA
Channel Id: undefined
Length: 14min 45sec (885 seconds)
Published: Tue Oct 29 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.