Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I diff two branches with fugitive?

In fugitive I can get the git status in a new window by :Gstatus and in that window to D on a file to get the diff in a new split.

It is also possible to get all versions of a file using :Glog and I can load all previous commits with :Glog --.

What I would like to do is to get a Gstatus window for the diff of two branches. For example my topic and development branch so I can diff all files that have changed.

Is it possible to get a interactive window with all the files that changed between two commits?

like image 693
tidbeck Avatar asked Nov 09 '12 08:11

tidbeck


1 Answers

As git does not support mercurial/bazaar status between two revisions neither fugitive can do it. Git has git diff --name-status instead, but simple grep reveals that this feature is never used in fugitive, except for checking of some file being clean (i.e. unmodified) when doing :Gw and friends.


If you are not afraid of somewhat experimental code, then you can try my aurum, it can bring you status window with

AuStatus rev topic wdrev development

and see vimdiff of specific file with C (closes status window by default, use let g:aurum_statwincmd='k' to avoid).

Note: with hg-git and vim compiled with +python aurum will be using more stable code as mercurial is the primary VCS I use.


Another idea is using vcscommand, mercurial/bazaar and hg-git/bzr-git. Then status will be viewed with

VCSStatus -r topic -r development

(mercurial, don’t remember how to do it in bazaar). I am unfamiliar with vcscommand though, so can’t say whether it offers as many interactive features in status buffer as fugitive or aurum do (seems it does not: nmap <buffer> in git status buffer shows nothing). The above code should work according to the documentation, but I have not tested.

like image 145
ZyX Avatar answered Oct 19 '22 08:10

ZyX