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

Re: problem with cherry picking

From
AEAndreas Ericsson <exon@op5.com>
Date
Apr 20, 2009, 22:20 UTC
Message-ID
<49ECF539.3030701@op5.com>
In-Reply-To
<450196A1AAAE4B42A00A8B27A59278E70ACE0021@EXCHANGE.trad.tradestation.com>
John Dlugosz wrote:
Show 16 quoted lines
> Someone at work here jumped the gun and committed something before
> fetching an amended branch.  Typical stuff -- now his work and the
> repo's work diverged.  His change was purely new files, no big deal.  In
> gitk, reset his dev to origin/remote/dev, then cherry-pick his new
> commit.
> 
> But it barfed all over the place.  One problem was read-only files.  But
> even after purging those, it had the same complaint, something about
> untracked file would be modified.  What's the deal here?
> 
> I talked him through accomplishing it another way -- reset hard back to
> his new commit, reset mixed to the proper ancestor, and re-doing the
> commit.
> 
> But I want to understand what the issue is here.
> 

When he first reset back to the pre-modified state, the newly created files were not removed from the working directory (this happens on soft or mixed resets, fe, or when a branch is moved).

The files were untracked by git as seen from the commit he reset to, and so git rightly refuses to apply another patch that introduces them, as that would mean overwriting files git knew nothing about (again, at the time of the commit he reset back to).

/Andreas
Previous: John Dlugosz
Message 2 of 2 in “problem with cherry picking”
  1. John DlugoszApr 20, 2009
  2. Andreas EricssonApr 20, 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.