Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Anyone want to help make zsh/db/gdbm work?



On Fri, Jan 23, 2015 at 8:47 PM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Fri, 23 Jan 2015 18:49:14 +0300
> ZyX <kp-pav@xxxxxxxxx> wrote:
>> 23.01.2015, 09:00, "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>:
>> > On Jan 23,  8:37am, ZyX wrote:
>> > } It looks like if you forgot to `git add` Doc/Zsh/mod_db_gdbm.yo. I do
>> > } not see it in the patch, only a small reference here.
>> >
>> > Actually what I didn't realize was that one has to diff against
>> > origin/master for new files, rather than against the local master.
>>
>> I have run into this problem a few times: by default git diffs against
>> index (not the current revision) and when you do `git add` then file
>> is added to the index as a whole making just `git diff` not present
>> it.
>
> The standard fix for this is "git diff --staged" (or --cached) but you
> have to remember --- it's particular confusing if you've got some stuff
> staged and some not as you only get to see diffs for one or other.  I'm
> not sure it's quite what Bart is talking about as that seems to be
> about committed files.

The best way to show a diff to someone is to finish what you're doing,
commit it, and then use git format-patch -1. If you really want to
diff the working tree without committing, git diff HEAD will always
show index+worktree diffed to the last commit (eg, what would be
committed with git commit -a), in addition to the other two variants
mentioned already (git diff: worktree to index, git diff --cached:
index to last commit).

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author