I have some commit on my branches. I want to merge the branches to trunk, but there have some commit that I don't merge to trunk on my branches. How do I do?
Have a local checkout of the branch to which you want to merge a range of revisions from a source branch. By default, "Merge a range of revisions" is clicked. Click Test Merge to check if it merges desired revisions/files.
Git merging combines sequences of commits into one unified history of commits. There are two main ways Git will merge: Fast Forward and Three way. Git can automatically merge commits unless there are changes that conflict in both commit sequences.
What you want to accomplish is usually called cherrypicking in version control systems.
Say that you want to merge revisions 345, 364 and 377 from your branch to trunk, you will do the following at the top level directory of a clean working copy of trunk
:
svn merge -c345,364,377 ^/_your_branch_
on Windows cmd
add quotes around the branch name:
svn merge -c345,364,377 "^/_your_branch_"
You can find more information in the corresponding section of the SVN Book.
Just to extend Yannick's answer.
When you can merge one/few specific commits from one to another branch you need(for example need merge commits r13 and r666 from branch 'from' into branch 'to'):
Check commits availability (just to ensure):
svn diff -c 13,666 https://fullpathtoyourproject/branches/_from_
Swith on branch to:
svn sw https://fullpathtoyourproject/branches/_to_
Merge commits
svn merge -c 13,666 https://fullpathtoyourproject/branches/_from_
If you need get 'fullpathtoyourproject' just type:
svn info
In section URL you will see this path.
I prefer to use FULL url/path, cause personally relative path did not work for me on some projects.
If one has TortoiseSVN installed, below are the steps to merge a range of revisions from a branch to the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With