Is there a way to merge single files in magit like you would do from this question or something equivalent. Namely:
$ git checkout source_branch -- <paths>...
Is there a way to merge single files in magit like you would do from this question or something equivalent. Namely:
$ git checkout source_branch -- <paths>...
As noted in many answers to the question you have linked to and even more so in comments on those answers, git checkout source_branch -- <paths>...
does not perform a merge.
Never-the-less there are of course situations when you want to do that - just don't call it a "merge". It would be much more appropriate to talk about "putting a file in the worktree into its state as per a certain commit".
You can do that with M-x magit-file-checkout
.
However you might actually be interested in only bringing in the changes (not final state) introduced by a certain commit to a certain file. To do that show the diff for that commit, then move to the file's heading in the diff and press a. That just applies just the changes that were introduced in that particular commit. You can also do that on the hunk and line level.
You can do this with M-x magit-file-checkout
This will allow you to pull in the changes from a specific file at a specific revision (you'll be prompted for those) into your working tree.