SVN -- Branch, Branching subversion howto
Branching subversion howto.
Creating the branch
Merge with the trunk
Back to the trunk
Delete your branch
Requirements
I suppose here your server is based on svn over ssh (svn+ssh), you can easily replace svn+ssh by https if you use Webdav for example.
svn+ssh://your/server/...
https://your/server/...
Creating the branch
Choose a branche name for example, MyBranch. Create the branch in the repository by copying the trunk:
$ svn copy svn+ssh://your/server/trunk svn+ssh://your/server/branches/MyBranch
Committed revision 3328.
Remember this commited revision number 3328.
If you have a local copy you do not need to checkout your branch just switch:
$ cd /your/local/copy
$ svn switch svn+ssh://your/server/branches/MyBranch .
Do not forget the dot at endline.
If you do not have a local copy you, checkout your branch:
$ mkdir /your/local/copy
$ cd /your/local/copy
$ svn checkout svn+ssh://your/server/branches/MyBranch .
Check if the localization is ok:
$ svn info | grep MyBranch
URL: svn+ssh://your/server/branches/MyBranch
Now you can work with your branch exactly as working on the trunk. (update, commit, etc …).
Merge with the trunk
You’ve been developing on your branch, and so have other people on trunk, and now you have to add their changes to your branch.
$ cd /your/local/copy
$ svn update
At revision 3269.
Add their changes to your branch:
$ svn merge -r3328:3269 svn+ssh://your/server/trunk .
U src/file.cpp
U src/file.h
This command finds all the changes in revisions 3329, 3330, … , 3269 that were made in the trunk, and applies them in Mybranch.
Now you must commit these changes to your branch repository; with appropriate comments to remember which range you have already merged:
$ svn ci -m "Merged the trunk from 3328 to 3269." .
Sending src/file.cpp
Sending src/file.h
Transmitting file data ..
Committed revision 3270.
After another interval of work, you will have to merge again to get the new changes. You specify a revision range that takes only the changes you haven’t already merged:
$ cd /your/local/copy
$ svn update
At revision 3333.
Add their changes to your branch:
$ svn merge -r3269:3333 svn+ssh://your/server/trunk .
U src/file.cpp
U src/file.h
This command finds all the changes in revisions 3370, 3371, … , 3333 that were made in the trunk, and applies them in Mybranch.
Now you must commit these changes to your branch repository:
$ svn ci -m "Merged the trunk from 3269 to 3333." .
Sending src/file.cpp
Sending src/file.h
Transmitting file data ..
Committed revision 3334.
Back to the trunk
Once you have finished your branch and you have merged again the last change from the trunk, you will commit your branch back to the trunk. Remember! MyBranch was created at revision number 3328. Now you have to add all your changes to the trunk.
$ cd /your/local/copy
$ svn update
At revision 3400.
Switch to the trunk and merge from Mybranch all the changes(3328:3400) to the trunk
$ svn switch svn+ssh://your/server/trunk
Check if the relocalization is ok:
$ svn info | grep MyBranch
URL: svn+ssh://your/server/trunk
Add all your changes to the trunk
$ svn merge -r3328:3400 svn+ssh://your/server/branches/MyBranch .
Now you must commit these changes to the trunk:
$ svn ci -m "branch back MyBranch into trunk" .
Sending src/file.cpp
Sending src/file.h
Transmitting file data ..
Committed revision 3334.
Delete your branch
At last, delete your branch
svn del svn+ssh://your/server/branches/MyBranch
If you found this post or this website helpful and would like to support our work, please consider making a donation. Thank you!
Help UsArticles in the same category
- Time a task: time
- SVN -- How to ignore file or directory in subversion?
- SVN -- Branch, Branching subversion howto
- Speedup GNU make build and compilation process
- phpMyAdmin: Search and Replace in MySQL database
- Linux How to delete or remove printer from command line
- Linux How to connect to Windows with remote desktop RDP in CentOS 7 / RedHat 7
- Intel compilation for MIC architecture KNL Knights Landing
- How to setup SSH timeout in shell script ?
- How to make a denial of a service with fork functions in BASH ?
- How to encrypt/decrypt a file or directory in Linux?
- How to diff remote files using ssh ?
- How to Convert Text File From ISO-8859-15 to UTF-8 Encoding
- How to change the MAC address on Linux
- Got permission denied while trying to connect to the Docker daemon socket
- GNU compilation for MIC architecture KNL Knights Landing
- Generating a self-signed certificate using OpenSSL with Linux CentOs/RedHat for Apache/httpd
- Find out biggest cpu/memory consuming processes with ps command
- Find list of options that python was compiled with
- Download music and videos .mp3, .wma, .avi, .mpg , divx with google
- Crontab : Scheduling Tasks
- Comment changer son adresse MAC sous Linux
- Check/find version of numpy i'm using
- Archiving and compressing data files tar
- Linux - Tip of the day