Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
This course is a gateway to learning software version control (SVC), process management, and collaboration techniques. Author Michael Lehman reviews the history of version control and demonstrates the fundamental concepts: check-in/checkout, forking, merging, commits, and distribution. The choice of an SVC system is critical to effectively managing and versioning the assets in a software development project (from source code, images, and compiled binaries to installation packages), so the course also surveys the solutions available. Michael examines Git, Perforce, Subversion, Mercurial, and Microsoft Team Foundation Server (TFS) in particular, describing the appropriate use, features, benefits, and optimal group size for each one.
The last major piece of functionality we're going to do with Perforce is branching and merging. You branch by right-clicking on your folder, in this case, and selecting Branch. Now Perforce does branching in the depot, not with the physical folders, but within folders within the depot. So what we're going to do is decide where we want to put our branch folder. And because it's not a physical folder, it's not a good idea to put your branch inside the folder with your main branch.
You want to put it within the depot perhaps as a peer of your main branch. So here's our source, depot/p1, and our target isn't going to be depot/p1, say b1 here. We're actually we're going to put it up here. We're going to say -branch1/, and after we do the branch we said automatically submit after branching the files. We're going to go take a look at the depot, and when we refresh it we see that we now have two different sets of folders in our depot.
And these files are different, we haven't created two separate folders in our workspace, but we just have two separate folders in our depot. So if we want to edit the file in the branch, we can go here Check Out and Open, and now we'll add a new feature, feature1, No more available space, Look to the cloud, Your hard drive is full, and we'll Save and Exit Visual Studio.
Again, you can see the files in the repository. The file has the check box, meaning we've checked it out into the default changelist, and now we're going to go ahead and submit that. Now we're going to say Added feature 1, and now it's all set up, and we're back in that particular branch's changelist. If you continue to work in a branch for an extended period of time ,you want to do a forward integration from the mainline to your branch from time to time. Remember, a forward integration means copying changes from the main into your private branch so that your branch doesn't get too far out of date for those portions of your code which you are not working on in the branch.
That means if you're working on a team and other people, they are making changes, you may want to take their changes as you're continuing to work on your features to make sure that both your features don't conflict with theirs and your features may depend upon working with their features before you can check back in. In our case, we're just going to do a reverse integration and merge the changes from our branch back into the trunk. The way we do that is we right-click on the branch folder, and we select Merge/Integrate. Now the Source of our merge is our branch.
The target of our merge is going to be back to p1. Now we're going to go ahead and open up the Options here in order to click this, Automatically resolve files after merging. That way it's a very simple merge process. If you want it to do the merge and then have to run the Merge tool to make that you have checked exactly what's being merged, you can do that by not checking that box. But in this case, we're going to click Merge, and you'll see now that says this file has been merged, and it's been marked for integrate but the change has not yet been saved back to the repository.
So we'll open up our changelist Pending window, and you see now we have Merging depot branch back to p1. And we'll right-click on that and say Submit. It gives us an automatic message here. We could create a more sophisticated one, but we'll submit that. And if we now come back here and say Open f1, you can see we have both our main and our feature. So the Merge has been successful, we've taken things from the branch1 and inserted them back into the main trunk, and so now everything is back together again.
And that's Branching and Merging in Perforce. We're going to take one quick peek at one more thing before we leave this chapter, and that is just note that installing the Perforce GUI also does give you a show integration menu that allows you to do additional things. Once you become much more experienced in working with Perforce, this can save you some time in the future. And that's it for version control with Perforce.
There are currently no FAQs about Fundamentals of Software Version Control.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.