Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN - how to apply change made in trunk to all branches

Tags:

merge

svn

I am a beginner in SVN.I have the SVN directory structure like this:

|-trunk
  |-file1.php
  |-file2.php
|-branches
  |-branch_1
    |-file1.php
    |-file2.php
  |-branch_2
    |-file1.php
    |-file2.php

In the trunk I have the main version of my application. I have two branches for different clients which have the modifications only in some files. When I find some core bug I fix it in trunk. For example I modified the file1.php in trunk directory. I want to apply changes to the files named file1.php in all the branches.

I am little confused. In the Version Control with Subversion I have found the following explanation.

Subversion's repository has a special design. When you copy a directory, you don't need to worry about the repository growing huge—Subversion doesn't actually duplicate any data. Instead, it creates a new directory entry that points to an existing tree.

So I though that when I commit a change in the file trunk\file1.php it will be automaticaly aplied to the other file1.php files as I didn't make any changes to that files in branches directory.

How can I apply changes from trunk directory to all the branches? I was trying to use svn merge like this:

svn merge -r 31:32 http://mysvnserver.com/project/branches/branch_1

but I didn't do any changes (svn diff -r 31:32 returns all the changes I made.)

like image 262
Lukasz Lysik Avatar asked Oct 29 '09 17:10

Lukasz Lysik


People also ask

How do I update svn trunk?

Select your trunk folder. Click and hold the right mouse button and drag it over to branches . If done correctly, a cascade menu will appear. Select SVN Copy and rename versioned item here.

What is the difference between trunk and branch in svn?

The trunk is the main line of development in a SVN repository. A branch is a side-line of development created to make larger, experimental or disrupting work without annoying users of the trunk version.


1 Answers

If you want to apply a change from trunk to branch_1, the merge command needs to specify where to get the diff from, and then specify a target to apply the merge to:

cd branch_1
svn merge -r 31:32 http://mysvnserver.com/project/trunk .
svn diff   # confirm that the only diff is your change to file1.php
svn commit
like image 57
Ether Avatar answered Oct 06 '22 00:10

Ether