Can magit do this for code outside of github?
EDIT: Actually, [0] mentions =L, which seems to work flawlessly. Hacking on an option to take the selected region instead of manually specifying file and lines is easy. Alternatively, magit-blame lets you look at a specific change's commit.