git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kevin Daudt <me@ikke.info>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing list <git@vger.kernel.org>
Subject: Re: [PATCH v2] gitcli: tweak "man gitcli" for clarity
Date: Wed, 22 Nov 2017 12:41:33 +0100	[thread overview]
Message-ID: <20171122114133.GD16418@alpha.vpn.ikke.info> (raw)
In-Reply-To: <alpine.LFD.2.21.1711220616230.11319@DESKTOP-1GPMCEJ>

On Wed, Nov 22, 2017 at 06:19:23AM -0500, Robert P. J. Day wrote:
> On Wed, 22 Nov 2017, Junio C Hamano wrote:
> 
> > "Robert P. J. Day" <rpjday@crashcourse.ca> writes:
> >
> > > git repo with a file called "Gemfile", so i created a branch called
> > > "Gemfile", and when i ran:
> > >
> > >   $ git checkout Gemfile
> > >
> > > git switched to the branch. so even with the ambiguity, git
> > > obviously has some sort of precedence order it checks. so what are
> > > the rules here?
> >
> > 31b83f36 ("Merge branch 'nd/checkout-disambiguation'", 2016-09-26)
> > should have made it clear that the "checkout" command has a
> > convenience special case.
> 
>   ok, then i'm still curious about git examples that actually fail due
> to an inability to disambiguate.
> 
> rday

Here is an example with git diff

    $ git init git-disambiguate
    $ cd git-disambiguate
    $ echo 1 >foo && git add foo && git commit -m foo
    $ git branch foo
    $ echo 2 >>foo && git add foo && git commit -m foo2
    $ echo 3 >>foo

    $ git diff foo
    fatal: ambiguous argument 'foo': both revision and filename
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    
    $ git diff HEAD foo
    fatal: ambiguous argument 'foo': both revision and filename
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'

    $ git diff HEAD -- foo
    diff --git a/foo b/foo
    index 1191247..01e79c3 100644
    --- a/foo
    +++ b/foo
    @@ -1,2 +1,3 @@
     1
     2
    +3

    $ git diff HEAD foo --
    diff --git a/foo b/foo
    index 1191247..d00491f 100644
    --- a/foo
    +++ b/foo
    @@ -1,2 +1 @@
     1
    -2
 

  reply	other threads:[~2017-11-22 11:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21 21:27 [PATCH v2] gitcli: tweak "man gitcli" for clarity Robert P. J. Day
2017-11-21 21:45 ` Kevin Daudt
2017-11-21 21:47   ` Robert P. J. Day
2017-11-21 22:04     ` Kevin Daudt
2017-11-21 22:12       ` Robert P. J. Day
2017-11-22  9:55   ` Robert P. J. Day
2017-11-22 10:34     ` Junio C Hamano
2017-11-22 11:19       ` Robert P. J. Day
2017-11-22 11:41         ` Kevin Daudt [this message]
2017-11-22 11:46           ` Robert P. J. Day
2017-11-23  0:03   ` Jeff King
2017-11-23  2:22     ` Junio C Hamano
2017-11-23  7:45     ` Robert P. J. Day
2017-11-23 13:51       ` Jeff King
2017-11-23 20:55         ` Kevin Daudt
2017-11-24  1:01           ` Junio C Hamano
2017-11-24 18:16             ` Jeff King
2017-11-24 18:12           ` Jeff King
2017-11-25  3:02             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171122114133.GD16418@alpha.vpn.ikke.info \
    --to=me@ikke.info \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rpjday@crashcourse.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).