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

Re: [PATCH] git-checkout.txt: Document "git checkout <pathspec>" better

From
Torsten Bögershausen <tboegi@web.de>
Date
Jun 12, 2015, 20:41 UTC
Message-ID
<557B43F6.9070502@web.de>
In-Reply-To
<20150612044906.GA17424@odin.ulthar.us>
On 2015-06-12 06.49, Scott Schmit wrote:
> 'git checkout' with <paths> or `--patch` is used to restore modified or
> deleted paths to their original contents from the index or replace paths
> with the contents from a named <tree-ish> (most often a commit-ish)
> instead of switching branches.

------------------- I will probably send a patch, the next days or so. It feels as if we can split the long sentence, and differntiate between the "restore" and "copy content from other tree-sh". How about this:

'git checkout' [--] <pathspec>...::
	'git checkout' with <paths> is used to restore modified or
	deleted paths to their original contents from the index.
'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::
	'git checkout' with [<tree-ish>] and <paths> or `--patch` is used
	to replace <paths> with the contents from a named <tree-ish>
	(most often a commit-ish) instead of switching branches.
	In this case, the `-b` and `--track` options are
	meaningless and giving either of them results in an error.  The
	<tree-ish> argument can be used to specify a specific tree-ish
	(i.e.  commit, tag or tree) to update the index for the given
	paths before updating the working tree.
+
Previous: Junio C Hamano
Message 12 of 12 in “git-checkout.txt: Document "git checkout <pathspec>" better”
  1. git-checkout.txt: Document "git checkout <pathspec>" betterTorsten Bögershausen, Jun 8, 2015
  2. Junio C HamanoJun 10, 2015
  3. Ed AvisJun 10, 2015
  4. Junio C HamanoJun 10, 2015
  5. Ed AvisJun 11, 2015
  6. Torsten BögershausenJun 10, 2015
  7. Junio C HamanoJun 11, 2015
  8. Ed AvisJun 11, 2015
  9. Junio C HamanoJun 11, 2015
  10. Scott SchmitJun 12, 2015
  11. Junio C HamanoJun 12, 2015
  12. Torsten BögershausenJun 12, 2015

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.