I have been working for sometime on a development branch. During this time I have changed and committed many files. The changes to one file, a shared library file, now need to be merged onto the master branch while leaving other files unchanged. How can this, merging one or more specific files from one branch to another, be achieved?
If there is a specific commit or set of commits that contain the changes you need (and none of the changes you don't), you can "cherry pick" the commits into another branch.
Otherwise, you'll need to copy the changes by hand. Merges effect the entire working copy.
You could do a merge and amend the merge commit to remove all the changes for the other files, but Git would see that as a commit that reverses those changes, and you'd have big problems if you decide to really merge those changes later on.
EDIT: Git does allow for "submodules" and "subtrees", which might give you the workflow you need, but I've never used them, and it doesn't sound like your library file is set up that way currently.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs