WorkingWithBranches - MIPT-ILab/MDSP GitHub Wiki

Intro

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:

  1. create a branch for a task you are going to work on;
  2. modify the code in the branch, build it, test it;
  3. commit your changes to the branch;
  4. request a code review from a mentor;
  5. mentor looks through the code in the branch, makes some comments, and eventually approves it;
  6. 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.

To create a branch and switch to it

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

To request a code review

  • Go to Issues list or Changes list.

  • Find your issue or change you wish to present.

  • Find request review link.

  • assign your reviewer as an owner;

    1. put comments for reviewer;
    2. specify the branch name;
  • Wait a response from the reviewer

  • If your code is accepted then proceed to merge your changes with trunk

To merge the branch with trunk

  1. Get a working copy (WC) of trunk, not a branch!
   svn checkout https://mdsp.googlecode.com/svn/trunk
  1. Remember the number of revision when your branch was created. Suppose it is 250.
  2. 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.

  1. 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.
  2. Commit the changes to the main trunk:
   svn commit -m 'Merged with new-branch-name'
  1. Congratulations! Now your work is available to the whole team. Hope you've done it well.

Notes

More details at http://svnbook.red-bean.com/en/1.0/re16.html and in Google :)

⚠️ **GitHub.com Fallback** ⚠️