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

Re: re-running merge on a single file

From
Jakub Narebski <jnareb@gmail.com>
Date
Mar 12, 2010, 09:00 UTC
Message-ID
<201003121000.25217.jnareb@gmail.com>
In-Reply-To
<a038bef51003111633v5d5d418bu332b63bb3874e3ef@mail.gmail.com>
On Fri, 12 Mar 2010, Chris Packham wrote:
> On Thu, Mar 11, 2010 at 3:20 PM, Jakub Narebski <jnareb@gmail.com> wrote:
Show 15 quoted lines
> > Try
> >
> >  $ git show :1:$(git rev-parse --show-prefix)cpu/mpc83xx/start.S \
> >    > cpu/mpc83xx/start.S.base
> 
> git show doesn't complain about the path. But I'm obviously not
> setting the stage correctly
> 
> $ git checkout --merge -- cpu/mpc83xx/start.S
> $ git show :1:$(git rev-parse --show-prefix)cpu/mpc83xx/start.S
> fatal: Path 'cpu/mpc83xx/start.S' is in the index, but not at stage 1.
> Did you mean ':0:cpu/mpc83xx/start.S'?
> 
> By now I have additional commits that touch cpu/mpc83xx/start.S so
> I'll see if I can find a file that I haven't touched since the merge.

Note that "git checkout --merge <file>" re-creates <file> in the state of textual merge conflict from the index (from stages 1, 2, 3). It is not able, unfortunately, to recover stages in index if you marked <file> as resolved using "git add <file>".

Note also that you would get non-0 stages in index only if there was a *merge conflict* for a file which was not automatically resolved. If cpu/mpc83xx/start.S resolved cleanly, it would be in stage-0 only.

You can check what stages you have in index for a specified file using
  $ git ls-files --stage cpu/mpc83xx/start.S

If you don't have stages 1 and 2 in the index (which you can check using command provided above), you can instead get versions of a file which would be used in resolving conflict:

 $ git show HEAD:cpu/mpc83xx/start.S \
   >cpu/mpc83xx/start.S.ours
 $ git show MERGE_HEAD:cpu/mpc83xx/start.S \
   >cpu/mpc83xx/start.S.theirs
 $ git show $(git merge-base HEAD MERGE_HEAD):cpu/mpc83xx/start.S \
   >cpu/mpc83xx/start.S.base
Sidenote: versions in stage 1, 2, 3 differ from above versions in that
they have those conflict (chunks) that can be automatically resolved,
resolved.
HTH
-- 
Jakub Narebski
Poland
Previous: Kris Shannon
Message 14 of 14 in “re-running merge on a single file”
  1. Chris PackhamMar 11, 2010
  2. Chris PackhamMar 11, 2010
  3. Markus HeidelbergMar 11, 2010
  4. Chris PackhamMar 11, 2010
  5. Jakub NarebskiMar 11, 2010
  6. Chris PackhamMar 12, 2010
  7. Johannes SixtMar 12, 2010
  8. Junio C HamanoMar 12, 2010
  9. Chris PackhamMar 12, 2010
  10. Chris PackhamMar 12, 2010
  11. Junio C HamanoMar 12, 2010
  12. Chris PackhamMar 12, 2010
  13. Kris ShannonMar 14, 2010
  14. Jakub NarebskiMar 12, 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.