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

Re: git cherry-pick before archive

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 11, 2008, 18:53 UTC
Message-ID
<alpine.DEB.1.00.0807111950540.8950@racer>
In-Reply-To
<6dbd4d000807111149s4fb661cak9fac152864260901@mail.gmail.com>
Hi,
On Fri, 11 Jul 2008, Denis Bueno wrote:
Show 13 quoted lines
> On Fri, Jul 11, 2008 at 14:46, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > BTW in your case, I would suggest this:
> >
> >        INDEX_FILE=.git/bla git read-tree HEAD &&
> >        INDEX_FILE=.git/bla git apply --cached patchfile &&
> >        INDEX_FILE=.git/bla git archive [...] &&
> >        rm .git/bla
> >
> > IOW: Just use a temporary index for your work.
> 
> What is the rationale?  So I can relieve the assumption that the index 
> is clean?
Not completely.

It will just leave the current index alone, ignoring the changes within it. It will also avoid having to update the index several times.

IMO it is just the thing you should do here: you do not want to stage anything for commit, so keep .git/index as-is, and use a temporary staging area instead.

It also avoids the need to "undo" things that might not be easily undone: if your patch contains stuff that was partly in the index, but uncommitted, neither "git reset" nor "git revert -n" will do what you want.

Ciao, Dscho

Previous: Denis BuenoNext: Junio C Hamano
Message 10 of 11 in “git cherry-pick before archive”
  1. Denis BuenoJul 11, 2008
  2. Johannes SchindelinJul 11, 2008
  3. Denis BuenoJul 11, 2008
  4. Miklos VajnaJul 11, 2008
  5. Denis BuenoJul 11, 2008
  6. Johannes SchindelinJul 11, 2008
  7. Denis BuenoJul 11, 2008
  8. Johannes SchindelinJul 11, 2008
  9. Denis BuenoJul 11, 2008
  10. Johannes SchindelinJul 11, 2008
  11. Junio C HamanoJul 11, 2008

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.