Navigation Menu

Skip to content

How Can I Selectively Merge Changes Between Two Branches While Retaining Both? #23266

Discussion options

You must be logged in to vote

If you want to apply individual commits from one branch to another (either way around) you can do that with git cherry-pick. Note that cherry-pick does not merge, it applies an existing change to another branch.

Otherwise there are two things that might be helpful:

  • If you make small changes on the master branch, it might be possible to just merge them into the refactoring branch.
  • Depending on what you’re refactoring it may be possible to do it in small stages, and after completing one stage you can test it and (if everything works) merge to master. Keeping the difference small makes merges easier.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants