WorkingWithBranches - MIPT-ILab/MDSP GitHub Wiki
Branches are used to separate your version of code, which is allowed to have some errors and even to not build, from the trunk that should be as stable as possible. The approximate work procedure is as follows:
- create a branch for a task you are going to work on;
- modify the code in the branch, build it, test it;
- commit your changes to the branch;
- request a code review from a mentor;
- mentor looks through the code in the branch, makes some comments, and eventually approves it;
- after an approvement merge your branch with the trunk.
Look through the details below. There are some commands that can be run from a command line (if you installed a command line version of svn
), but you can easily find the way to do it from TortoiseSVN.
From the root of your SVN working copy:
svn copy . https://mdsp.googlecode.com/svn/branches/new-branch-name -m 'reason of creation'
svn switch https://mdsp.googlecode.com/svn/branches/new-branch-name
-
Go to Issues list or Changes list.
-
Find your issue or change you wish to present.
-
Find request review link.
-
- put comments for reviewer;
- specify the branch name;
-
Wait a response from the reviewer
-
If your code is accepted then proceed to merge your changes with trunk
- Get a working copy (WC) of trunk, not a branch!
svn checkout https://mdsp.googlecode.com/svn/trunk
- Remember the number of revision when your branch was created. Suppose it is 250.
- Inside the trunk WC run the command:
svn merge -r 250:HEAD https://mdsp.googlecode.com/svn/branches/new-branch-name
where
250:HEAD
is a range of revisions since the moment of branch creation to its latest version.
- Now your WC of trunk has merged version of the branch and the changes from trunk. If you have some messages of conflicts, resolve them (how? this is another story...), if everything is OK, proceed to the next step.
- Commit the changes to the main trunk:
svn commit -m 'Merged with new-branch-name'
- Congratulations! Now your work is available to the whole team. Hope you've done it well.
More details at http://svnbook.red-bean.com/en/1.0/re16.html and in Google :)