Skip to content

Instantly share code, notes, and snippets.

@maxkomarychev
Last active March 13, 2018 15:33
Show Gist options
  • Save maxkomarychev/6724f2cd5f1c187a4452a661d536def0 to your computer and use it in GitHub Desktop.
Save maxkomarychev/6724f2cd5f1c187a4452a661d536def0 to your computer and use it in GitHub Desktop.
git partial merge
suppose you have two branches: `master` and `huge_feature` and you want to merge `huge_feature` into `master` but partially
you also can not use `git cherry-pick`, you want to have *real merge* but with partially applied patch
1. git checkout master
2. git merge --no-ff --no-commit huge_feature
3. git reset *
4. git add -i // interactively stage what you want https://git-scm.com/book/en/v2/Git-Tools-Interactive-Staging
5. git commit
6. git checkout huge_feature
7. git merge -s ours master // this is to be able to merge huge_feature into master later
credit to this answer (and related question): https://stackoverflow.com/questions/27403223/how-to-re-merge-a-branch-after-a-partial-merge-was-performed/27410108#27410108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment