Create a branch:
svn copy http://myserver.com/repos/myproj/trunk \
http://myserver.com/repos/myproj/branches/myproj-branch \
-m "Creating a private branch of /myproj/trunk."
Checkout a branch:
svn co http://myserver.com/repos/myproj/branches/myproj-branch
Merge my local copy of a branch with trunk
svn status
#make sure your local copy is in sync with the branch first.
#preview what will be merged:
svn merge http://myserver.com/repos/myproj/trunk --dry-run
#do the merge:
svn merge http://myserver.com/repos/myproj/trunk
svn commit -m "Merged latest trunk changes to myproj-branch."
# can also merge per revision:
svn mergeinfo --show-revs eligible http://myserver.com/repos/myproj/trunk
svn merge -r xxx:xxx http://myserver.com/repos/myproj/trunk
# or per 1 revision instead of range
svn merge -c xxx http://myserver.com/repos/myproj/trunk
Merge my branch with the trunk
cd ~/myproj-trunk
svn update
svn merge --reintegrate http://myserver.com/repos/myproj/branches/myproj-branch
svn commit -m "Merge myproj-branch back into trunk!"
can also test before merging with --dry-run
merge status code:
A Added
D Deleted
U Updated
C Conflict
G Merged
E Existed
R Replaced
I Ignored
M Modifed
X Unversioned, used external
? Unversioned
# Missing
~ Obstructed by another item
Delete my branch:
svn delete http://myserver.com/repos/myproj/branches/myproj-branch -m "Remove myproj-branch."
To see which changes have been merged to which branches:
cd myproj-branch
svn propget svn:mergeinfo
svn mergeinfo
#Which changes have already been merged from trunk to branch
svn mergeinfo http://myserver.com/repos/myproj/trunk
Which changes are still eligible to merge from trunk to branch:
svn mergeinfo http://myserver.com/repos/myproj/trunk --show-revs eligible
Show changes since creation of branch:
svn log --verbose --stop-on-copy http://myserver.com/repos/myproj/branches/myproj-branch
Merge 2 branches from same parent:
cd myproj-branch1
svn update #get what is latest revision
svn log --verbose --stop-on-copy http://myserver.com/repos/myproj/branches/myproj-branch2 # at wich revision was branch2 created?
svn merge -r 10:15 http://myserver.com/repos/myproj/branches/myproj-branch2 #merge modifs since branch2 was created to branch1