How to merge branches in Git by "hunk"
Posted
by
user1316464
on Stack Overflow
See other posts from Stack Overflow
or by user1316464
Published on 2012-04-05T23:19:05Z
Indexed on
2012/04/05
23:28 UTC
Read the original article
Hit count: 179
Here's the scenario. I made a "dev" branch off the "master" branch and made a few new commits. Some of those changes are going to only be relevant to my local development machine. For example I changed a URL variable to point to a local apache server instead of the real URL that's posted online (I did this for speed during the testing phase). Now I'd like to incorporate my changes from the dev branch into the master branch but NOT those changes which only make sense in my local environment.
I'd envisioned something like a merge --patch which would allow me to choose the changes I want to merge line by line.
Alternatively maybe I could checkout the "master" branch, but keep the files in my working directory as they were in the "dev" branch, then do a git add --patch. Would that work?
© Stack Overflow or respective owner