git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] gitcli: tweak "man gitcli" for clarity

From
Kevin Daudt <me@ikke.info>
Date
Nov 22, 2017, 11:41 UTC
Message-ID
<20171122114133.GD16418@alpha.vpn.ikke.info>
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:
Show 21 quoted lines
> 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
 
Previous: Robert P. J. DayNext: Robert P. J. Day
Message 9 of 19 in “gitcli: tweak "man gitcli" for clarity”
  1. gitcli: tweak "man gitcli" for clarityRobert P. J. Day, Nov 21, 2017
  2. Kevin DaudtNov 21, 2017
  3. Robert P. J. DayNov 21, 2017
  4. Kevin DaudtNov 21, 2017
  5. Robert P. J. DayNov 21, 2017
  6. Robert P. J. DayNov 22, 2017
  7. Junio C HamanoNov 22, 2017
  8. Robert P. J. DayNov 22, 2017
  9. Kevin DaudtNov 22, 2017
  10. Robert P. J. DayNov 22, 2017
  11. Jeff KingNov 23, 2017
  12. Junio C HamanoNov 23, 2017
  13. Robert P. J. DayNov 23, 2017
  14. Jeff KingNov 23, 2017
  15. Kevin DaudtNov 23, 2017
  16. Junio C HamanoNov 24, 2017
  17. Jeff KingNov 24, 2017
  18. Jeff KingNov 24, 2017
  19. Junio C HamanoNov 25, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.