HowTo: SVN Merging
HowTo: SVN Merging
article118
SVN Branch, Branching su!ersion howto
Wednesday 26 May 2010, by Nadir SOUALEM
Requirements
I suppose here your server is based on svn over ssh (svn+ssh, you !an
easi"y rep"a!esvn+ssh by https i# you use Webdav #or e$a%p"e&
svn+ssh://your/server/...
https://your/server/...
Creating the branch
'hoose a bran!he na%e #or e$a%p"e, MyBranch& 'rea(e (he bran!h in
(he reposi(ory by !opyin) (he (run*+
$ svn copy svn+ssh://your/server/trunk
svn+ssh://your/server/branches/MyBranch
Committed revision 3328.
,e%e%ber (his !o%%i(ed revision nu%ber 3328&
I# you have a "o!a" !opy you do no( need (o !he!*ou( your bran!h -us(
s.i(!h+
$ cd /your/local/copy
$ svn sitch svn+ssh://your/server/branches/MyBranch .
/o no( #or)e( (he do( a( end"ine&
I# you do no( have a "o!a" !opy you, !he!*ou( your bran!h+
$ mkdir /your/local/copy
$ cd /your/local/copy
$ svn checkout svn+ssh://your/server/branches/MyBranch .
'he!* i# (he "o!a"i0a(ion is o*+
$ svn in!o " #rep MyBranch
$%&: svn+ssh://your/server/branches/MyBranch
No. you !an .or* .i(h your bran!h e$a!("y as .or*in) on (he (run*&
(upda(e, !o%%i(, e(! &&&&
Merge with the trunk
1ou2ve been deve"opin) on your bran!h, and so have o(her peop"e on
(run*, and no. you have (o add (heir !han)es (o your bran!h&
$ cd /your/local/copy
$ svn update
't revision 32().
Add (heir !han)es (o your bran!h+
$ svn mer#e *r3328:32() svn+ssh://your/server/trunk .
$ src/+le.cpp
$ src/+le.h
3his !o%%and 4nds a"" (he !han)es in revisions 5526, 5550, &&& , 5266 (ha(
.ere %ade in (he (run*, and app"ies (he% in Mybran!h&
No. you %us( !o%%i( (hese !han)es (o your bran!h reposi(ory7 .i(h
appropria(e !o%%en(s (o re%e%ber .hi!h ran)e you have a"ready
%er)ed+
$ svn ci *m ,Mer#ed the trunk !rom 3328 to 32()., .
-endin# src/+le.cpp
-endin# src/+le.h
.ransmittin# +le data ..
Committed revision 32/0.
A#(er ano(her in(erva" o# .or*, you .i"" have (o %er)e a)ain (o )e( (he ne.
!han)es& 1ou spe!i#y a revision ran)e (ha( (a*es on"y (he !han)es you
haven2( a"ready %er)ed+
$ cd /your/local/copy
$ svn update
't revision 3333.
Add (heir !han)es (o your bran!h+
$ svn mer#e *r32():3333 svn+ssh://your/server/trunk .
$ src/+le.cpp
$ src/+le.h
3his !o%%and 4nds a"" (he !han)es in revisions 5580, 5581, &&& , 5555 (ha(
.ere %ade in (he (run*, and app"ies (he% in Mybran!h&
No. you %us( !o%%i( (hese !han)es (o your bran!h reposi(ory+
$ svn ci *m ,Mer#ed the trunk !rom 32() to 3333., .
-endin# src/+le.cpp
-endin# src/+le.h
.ransmittin# +le data ..
Committed revision 3331.
Back to the trunk
On!e you have 4nished your bran!h and you have %er)ed a)ain (he "as(
!han)e #ro% (he (run*, you .i"" !o%%i( your bran!h ba!* (o (he (run*&
,e%e%ber9 My:ran!h .as !rea(ed a( revision nu%ber 3328& No. you
have (o add a"" your !han)es (o (he (run*&
$ cd /your/local/copy
$ svn update
't revision 3100.
S.i(!h (o (he (run* and %er)e #ro% Mybran!h a"" (he
!han)es(3328:3100 (o (he (run*
$ svn sitch svn+ssh://your/server/trunk
'he!* i# (he re"o!a"i0a(ion is o*+
$ svn in!o " #rep MyBranch
$%&: svn+ssh://your/server/trunk
Add a"" your !han)es (o (he (run*
$ svn mer#e *r3328:3100
svn+ssh://your/server/branches/MyBranch .
No. you %us( !o%%i( (hese !han)es (o (he (run*+
$ svn ci *m ,branch back MyBranch into trunk, .
-endin# src/+le.cpp
-endin# src/+le.h
.ransmittin# +le data ..
Committed revision 3331.
Delete your branch
A( "as(, de"e(e your bran!h
svn del svn+ssh://your/server/branches/MyBranch