开发者

SVN Merge Trunk to a Branch

开发者 https://www.devze.com 2022-12-20 19:56 出处:网络
Assume the following scenario. I have two file开发者_开发知识库s A.cpp and B.cpp in trunk. At revision 50 I create an experimental branch called X. Therefore at revision 50 both trunk and branch X ar

Assume the following scenario.

I have two file开发者_开发知识库s A.cpp and B.cpp in trunk. At revision 50 I create an experimental branch called X. Therefore at revision 50 both trunk and branch X are the same.

I continue to work on trunk and add C.cpp and D.cpp. I then realize that there is a bug in A.cpp and so I fix the bug.

Now my question is how do I send the updated A.cpp to branch X without sending the other files(B.cpp C.cpp D.cpp)?


In a working copy of the branch, merge the revision that updated A.cpp. Alternatively, if you have no local branch changes you need to preserve, you could just svn copy A.cpp from trunk and overwrite your local A.cpp.

Example

cd workingCopyOfX
svn merge -r50:51 http://my.repo.com/trunk/A.cpp

assuming the fix was made in r51


Depending on what platform you are on depends on how this is shown in the interface, but you should just be able to right click on the file and select merge, or deselect the files that you do not want to merge in the interface.

If you are working on a command line environment then you should just be able to run svn merge and type in the filename.

More details (although old I believe they're still relevant) can be found here


There're probably many ways but I find it easier to do it this way:

  1. Go to a fresh (unmodified) working copy of target (X branch)
  2. Merge the whole revision from source (trunk) into your working copy
  3. Inspect local changes: revert unwanted changed files and maybe do some manual edits in wanted files
  4. When you're happy, commit
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号