Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is there a way to do a merge from one branch to another but file-by-file?

roam_scott
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 17, 2018

I have two branches that have diverged. I need to merge *most* of /master into the new branch but not all of it. I tried "Merge master into current branch" but it, of course, overwrote files I didn't want it to.  I'm hoping to find some sort of "manual-but-not-manual merge" where it would prompt me for each change and I could step through and select which ones to merge.

I can do this in WinMerge (and have been) but it takes a LONG time to generate the diff.

Does SourceTree have anything like this?

1 answer

0 votes
minnsey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2018

Hi

It depends if your file changes are cleanly encapsulated by atomic single file commits.

If they are then you could use either cherry-picking, if you want history, or patch files, if history doesn't matter. Either of which can be done in Sourcetree.

If they aren't then I think you are in to the world of rebasing. The following gives some pointers https://stackoverflow.com/a/449632. Sourcetree can help with this, but you may well find it easier to follow the examples using the command line.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events