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

Re: Why does git-checkout accept a tree-ish?

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2017, 17:57 UTC
Message-ID
<xmqqshi8b04b.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<EA993AC0-022C-423D-ABD7-4747FA09E7FE@fabulich.com>
Dan Fabulich <dan@fabulich.com> writes:
Show 24 quoted lines
> I was looking back through git's history, trying to figure out why
> git-checkout has so many features. I was struck by this commit by
> Junio in 2005.
>
> https://github.com/git/git/commit/4aaa702794447d9b281dd22fe532fd61e02434e1
>
>> git-checkout: revert specific paths to either index or a given tree-ish.
>> When extra paths arguments are given, git-checkout reverts only those
>> paths to either the version recorded in the index or the version
>> recorded in the given tree-ish.
>> 
>> This has been on the TODO list for quite a while.
>
> Prior to this commit, git-checkout would only switch branches; you
> could use git-checkout-index to copy files from the index to the
> working tree. But in this commit, git-checkout not only subsumes
> the functionality of git-checkout-index but also learns the
> ability to copy files from an arbitrary branch (now an arbitrary
> tree-ish) into the working copy *and* the the index. (That was
> important because git-reset didn't accept <paths> in 2005.)
> ...
> And so I wonder if anybody knows just why git-checkout gained
> these two features in one commit, without creating a separate
> command.
The whole thread would explain it, I think.
https://public-inbox.org/git/Pine.LNX.4.64.0510171814430.3369@g5.osdl.org/#t
Previous: Dan FabulichNext: Junio C Hamano
Message 2 of 3 in “Why does git-checkout accept a tree-ish?”
  1. Dan FabulichApr 5, 2017
  2. Junio C HamanoJul 7, 2017
  3. Junio C HamanoJul 7, 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.