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

Re: [RFC] New command: 'git snapshot'.

From
USUlrik Sverdrup <ulrik.sverdrup@gmail.com>
Date
Feb 10, 2009, 23:58 UTC
Message-ID
<a1b6cb1b0902101558s7df025c7hfe078638452413c@mail.gmail.com>
Show 9 quoted lines
> On Tue, Feb 10, 2009 at 3:08 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > Jeff King <peff@peff.net> writes:
> > How is it different from "git stash create"?
>
> Git stash doesn't touch untracked files, whereas git snapshot would.
> Take another closer look at the table in the original post titled
> "What are the differences between 'git stash' and 'git snapshot'?"
>
> -Geoffrey Lee

I'm understanding this just as I read this, but it seems that implementing a git snapshot (I'm myself interested), could be done quickly with a new git. (When was git stash create introduced? I don't know it?)

Something like this: cp .git/index .git/tmp-index GIT_INDEX_FILE=.git/tmp-index git add -N . git stash create

So we use add -N to put all files into tracked but unstaged by default, but we keep our old index. Now stash is ready to save off the working directory, and further logic has to be applied on the returned commit to save it off..

Ulrik Sverdrup
Next: Ulrik Sverdrup
Message 1 of 3 in “Re: [RFC] New command: 'git snapshot'.”
  1. Ulrik SverdrupFeb 10, 2009
  2. Ulrik SverdrupFeb 11, 2009
  3. Nanako ShiraishiFeb 11, 2009

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.