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

Re: Can I checkout a single file without altering index?

From
NKNeal Kreitzinger <neal@rsss.com>
Date
Oct 15, 2010, 18:30 UTC
Message-ID
<i9a6kn$d7o$1@dough.gmane.org>
In-Reply-To
<loom.20101014T095743-275@post.gmane.org>

"Christian Halstrick" <christian.halstrick@gmail.com> wrote in message news:loom.20101014T095743-275@post.gmane.org...

Show 14 quoted lines
> Thank's a lot for all your responses. I know now how to solve my problem. 
> I'll
> definitely not going to commit my unit-test before my fix and publish that
> because then I would have commits in the history where tests fail. But 
> other
> suggested solutions do work.
>
> Still, all that sounds like workarounds for a lacking feature. Checkout 
> content
> to the worktree without altering the index. What do you think, couldn't 
> that be
> added as an option to checkout?
>
> -- Chris

FWIW, my understanding of the index is that it is the middle-man for moving things from your work-tree to the object-store AND for moving things from the object-store to your work-tree. Therefore, when you checkout the blob, it first gets copied from the object-store to your index and then from the index to your work-tree.

However, there is an option in git-commit to copy files directly from the working-tree to the object-store by totally bypassing the index, but no one seems to do this or recommend doing this as normative practice. None the less, this "exception" in the git-commit manpage does seem to set the precedent, so maybe it is also conceivable to copy objects directly from the object-store to the work-tree by totally bypassing the index.

Please note that I am responding because I am interested in the discussion and not because I know the answer. I am not a git programmer so my observations only symptomatic and/or theoretical as a user.

v/r, Neal

Previous: Christian HalstrickNext: Jonathan Nieder
Message 8 of 16 in “Can I checkout a single file without altering index?”
  1. Christian HalstrickOct 12, 2010
  2. Michael J GruberOct 12, 2010
  3. Stefan NaeweOct 12, 2010
  4. Jared HanceOct 13, 2010
  5. Alex RiesenOct 12, 2010
  6. Tomas CarneckyOct 12, 2010
  7. Christian HalstrickOct 14, 2010
  8. Neal KreitzingerOct 15, 2010
  9. Jonathan NiederOct 15, 2010
  10. Jeff KingOct 15, 2010
  11. Jonathan NiederOct 15, 2010
  12. Jeff KingOct 15, 2010
  13. Neal KreitzingerOct 15, 2010
  14. Andreas SchwabOct 15, 2010
  15. Junio C HamanoOct 15, 2010
  16. Jonathan NiederOct 15, 2010

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.