From: Johannes Sixt Date: Thu, 31 May 2018 23:08:36 GMT Subject: Re: is there a reason pre-commit.sample uses "git diff-index"? Message-ID: In-Reply-To: Am 31.05.2018 um 19:27 schrieb Robert P. J. Day: > On Thu, 31 May 2018, Duy Nguyen wrote: >> git diff-index is "plumbing", designed for writing scripts. "git >> diff" on the other hand is for users and its behavior may change >> even if it breaks backward compatibility. > > ah, this was a philosophical underpinning i was unaware of. i see > occasional explanations of git porcelain versus plumbing, but i don't > recall anyone simply stating that the plumbing is meant to have a > long-term stability that is not guaranteed for the porcelain. So, there you have it. ;) Plumbing commands offer long-term stability. That is not just philosophical, but practically relevant. > in any event, this does mean that, stability issues aside, "git > diff" would apparently have worked just fine for that hook. It may have worked just fine. You should still not use it. Didn't you say that you are teaching git and hooks? Then you should teach the right thing, and the right thing is to use plumbing for scripts. -- Hannes