I'm not aware of a builtin way to do this.
Assuming you're on branch A, another approach would be to diff branch
B (d r ..B
), and then move point to the file you're interested in.
Pressing a
will apply those changes to the working tree (rather than
the index).
I have a command in my configuration to reset or checkout a file from
a revision, but, in its current state, it doesn't fit exactly what
you're asking for because it won't offer a good revision default when
in Magit Revision mode.
(defun km/magit-reset-file (rev file &optional checkout)
"Reset FILE from revision REV.
If prefix argument CHECKOUT is non-nil, checkout FILE from REV
instead.
\(git reset REV -- FILE)
\(git checkout REV -- FILE)"
(interactive
(let ((rev (magit-read-branch-or-commit "Revision")))
(list rev (magit-read-file-from-rev rev "File") current-prefix-arg)))
(magit-with-toplevel
(magit-run-git (if checkout "checkout" "reset")
rev "--" file)))