I have created a branch, lots of revisions have been committed to it. Meanwhile, some changes has been done in trunk too. So I created a new branch and manually merged the revisions in the trunk to newly created branch, because branch has major changes whereas trunk changes are relatively minimal.
Now I have to replace the trunk with new branch. I saw various post suggesting to delete the trunk. But that's not a feasible solution for me, trunk has revisions of the file from the very beginning, I don't want to loose them. When I try to merge the trunk and new branch in Eclipse, it terminates abnormally.
While checking the files that are marked as conflict, the latest changes from branch are not properly shown in compare window(A file named filename.java.2.working
contains latest branch changes, but that file is not shown on compare window in eclipse).
Does anyone know a solution to replace trunk with branch without deleting trunk?
Eg: Branch created at version 12121 Trunk latest 12500 Branch latest 12777
Now when I do the merge, I want all the files to be committed at version 12501 in trunk.
TL;DR: You cannot delete an SVN location and assign its history to another location, even if they are named the same. What you can do is merge to the right place and preserve all original history.
Now, let me get this straight:
trunk
. branch A
. trunk
has some minor changes. branch B
off branch A
? It's really not clear what you created the branch B
off trunk
changes to branch B
branch B
to become your trunk
(in other words, you need to merge whole branch B
to trunk
) Why didn't you just merge those minor changes from trunk
to branch A
directly, thus keeping branch in sync , and then reintegrate branch A
to trunk
? You are supposed to keep your feature branch in sync with trunk on daily basis, the more often the better. The only time you shouldn't be keeping a branch in sync is when this is a release branch, and you don't want new trunk changes in it. But from your question, you do want trunk
changes in branch A
, no?
branch B
seems completely redundant here. I don't know anything about Eclipse, but it is probably failing because branch B
is not a direct descendant from trunk
.
Performing:
branch A
to trunk
nets the same effective result as performing:
branch B
off branch A
trunk
to branch B
branch B
back to trunk
to preserve trunk
history The complexity of the merge between " branch A
-> trunk
" is identical as the complexity of the merge between " trunk
-> branch B
(which is same as branch A
)"
Please provide your reasons for branch B
existence, maybe I am completely missing some point here.
What you should have done is:
trunk
or update your existing checkout trunk
, select TortoiseSVN
-> Merge
branch A
Show Log
, select all revisions you want to merge, or you can specify a range with 12121-12777
Next
Merge
trunk
to SVN. The above commit in SVN will clearly show that these changes came from Branch A
If there are conflicts, you have to resolve them using whatever diff tool you have configured. That file filename.java.2.working
that you mentioned is a conflict resolution file. When SVN detects conflicts between two files that it cannot automatically resolve, it will provide you with a copy of "your" file, a copy of "their" file, and a "merge" file. You pick-n-chose between "yours" and "theirs" files into the "merge file", and then mark the conflict as resolved. Once marked "resolved", all 3 are deleted from the workplace and replaced with the original filename, containing the contents of "merged" file. This is what then gets committed.
Quick and dirty in your situation:
Given that you already created redundant branch B
and already merged trunk
changed to branch B
, and now want branch B
to become your new trunk
, you can do the following quick and dirty
trunk
or update your existing checkout branch B
checkout folder, select TortoiseSVN -> Export
, and export to new folder trunk
checkout (overwrite) trunk
The above will appear as direct commit, and will not show that changes came from branch B
Lastly:
Eg: Branch created at version 12121 Trunk latest 12500 Branch latest 12777. Now when I do the merge, I want all the files to be committed at version 12501 in trunk.
Above is impossible, as any new commit anywhere in SVN (any trunk or branch) will have a revision 12778
or higher. Also note this is a revision , there is no such thing as version in SVN, and you cannot think of "revisions" as a "version", it is not the same thing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.