magit: how to diff the same file between two different commits on the same branch?

左心房为你撑大大i 提交于 2019-12-03 11:07:12

In case anyone stumbles across this now, it is now possible to do this in magit (I do this from magit-log but you can probably do it from elsewhere, too):

  1. Type d to open the magit-diff-popup
  2. Type =f to specify the file you want to view (enter path relative to the project root dir)
  3. Type r to do a diff range. You will be asked for the commit range, for example, 4abcde2..HEAD. Alternately, if you highlight the range of commits in magit-log, the range will be set for you automatically with no prompt.

This way, you end up in a magit-diff buffer complete with highlighting and code folding.

Dror

One way to go is to use vc as suggested by this related answer - in particular C-u C-x v =. However, this return a buffer without the possibility to (un)fold chunks.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!