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

Re: [PATCH] Attempt to make git-checkout man page a bit more clear.

From
Junio C Hamano <junkio@cox.net>
Date
Dec 21, 2006, 07:47 UTC
Message-ID
<7vbqlx1yht.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20061221015350.245cc964.seanlkml@sympatico.ca>
Sean <seanlkml@sympatico.ca> writes:
Show 20 quoted lines
> diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
> index fbdbadc..97c3afe 100644
> --- a/Documentation/git-checkout.txt
> +++ b/Documentation/git-checkout.txt
> @@ -8,23 +8,29 @@ git-checkout - Checkout and switch to a branch
>  SYNOPSIS
>  --------
>  [verse]
> +'git-checkout' [-f] [-m] <branch>
> +'git-checkout' [-f] [-b <new_branch> [-l]] [-m] [<commit-ish>]
>  'git-checkout' [-m] [<branch>] <paths>...
>  
>  DESCRIPTION
>  -----------
> ...
> +With the third form, this command does *not* switch branches.
> +Instead, it replaces the contents of the named paths in your
> +working tree from the index.  Here, the <branch> argument can be
>  used to specify a specific tree-ish to update the index for the
>  given paths before updating the working tree.

The 'restore from arbitrary tree-ish' form does not take -m as far as I know.

Although it might be interesting to do a single-file three-way merge, I do not think the command is _checkout_ anymore once it starts doing that.

That is:
	$ git checkout -f master
	$ edit file.c
        $ git that-funny-command next file.c

would steal the version of file.c from 'next', and merge the change your locally did on top of 'master', and put it in your working tree and in the index. Technically I can explain how that work (and how it could be implemented -- which is trivial), but I cannot explain what that operation _means_.

Previous: SeanNext: Sean
Message 2 of 4 in “Attempt to make git-checkout man page a bit more clear.”
  1. Attempt to make git-checkout man page a bit more clear.Sean, Dec 21, 2006
  2. Junio C HamanoDec 21, 2006
  3. SeanDec 21, 2006
  4. Jakub NarebskiDec 21, 2006

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.