Friday, July 8, 2011

Re: Fugitive

On Fri, Jul 8, 2011 at 7:22 PM, Benjamin R. Haskell <vim@benizi.com> wrote:
>> On 08/07/11 16:10, eleanor wrote:
>>>
>>> Hi, I'm testing the fugitive plugin for the time being and I've come
>>> accross the following problems:
>>> 1)
>>> - If I add and commit a file called a.txt with the text "aaa"
>>> - and then change the text to "bbb" and save it and commit it
>>> - and then change the text to "ccc" and save it (without commiting)
>>> - and then do the Gdiff ... I get to compare the "bbb" against "ccc"
>>>
>>> Why? Shouldn't Gdiff only compare values that form the actual revisions -
>>> so in this case the "aaa" against "bbb", since the "ccc" is not part of a
>>> revision yet - because it has not been commited to the repository.
>
> I don't use fugitive, so don't know the rest, but this is the same way `git
> diff` behaves.  Without arguments it compares what's in the working copy to
> HEAD.

To be slightly pedantic, git diff compares the index - not HEAD - to the
working copy. So if you have staged (git add'ed) some changes, those
won't be included.

Use :Gdiff HEAD~1 or just :Gdiff ~1 if you want to compare against the
previous commit rather than the index.

BTW, fugitive is seriously awesome, and you're missing out as a vim/git
user if you aren't already using it. :Gblame alone to open a scroll locked
buffer besides the current one with git blame output is invaluable if you're
working on a larger project (just discovered today that you can view the
corresponding commit object (including the commit message) by pressing
o or O in the blame buffer - another neat timesaver).

/Ulf

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: