From: Junio C Hamano Date: Thu, 12 Jan 2012 02:26:30 GMT Subject: Re: git diff HEAD^: error message Message-ID: <7vr4z54pwp.fsf@alter.siamese.dyndns.org> In-Reply-To: <20120111111831.GB15232@beez.lab.cmartin.tk> Carlos Martín Nieto writes: > I was trying to figure out why running > > git diff HEAD^:RelNotes RelNotes > > gives the expected output (on maint it tells me that the stable > version changed from 1.7.8.3 to 1.7.8.4) but swapping the arguments > doesn't. > > git diff RelNotes HEAD^:RelNotes > > doesn't show the opposite patch ... That comes from the general argument parsing rules of Git, namely, global options (e.g. --paginate) first, then subcommand name, followed by dashed options, revs and finally the paths. Once you give "RelNotes", which cannot be a rev, you cannot give a rev. We _could_ special case the rule for "diff", but we simply didn't bother, as the resulting code (and the implications of special casing) would be too ugly to live to support such a corner case usage, especially when you could always say "-R" to reverse the output.