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

Re: git add -p and unresolved conflicts

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Mar 29, 2012, 07:26 UTC
Message-ID
<vpqvclnhnpc.fsf@bauges.imag.fr>
In-Reply-To
<4F737027.5020503@ira.uka.de>
Holger Hellmuth <hellmuth@ira.uka.de> writes:
Show 9 quoted lines
>> And you miss the most usefull (to me at least): "choose the version in
>> the worktree".
>>
>
> But the conflicted chunks are of the form "<<<< our ... ||||||||||
> theirs >>>>>>" in your work tree. So there are two cases:
>
> a) You have removed the markers thereby removing the conflict -> this
> means the chunk will not be offered to you as a conflicting chunk

If you have removed the markers, then the file is still marked as conflicted in the index, and the user may still want to see the combined diff.

My use-case is actually quite simple: I see "git add -p" both as a way to make partial commits, and as a way to manually validate what I'm about to commit. I review the diff, validate them with "y", and if I see something wrong, I quit "git add -p", fix the issue, and next "git add -p" won't show it again. This flow could work also with conflicts:

$ git add -p # see an unresolved diff for file foo.txt n # see a resolved diff for file bar.txt y <-- the "missing" possibility for me $ edit foo.txt $ git add -p # see resolution for file foo.txt y $ git commit

The "'git reset $path' before 'add -p'" workaround is not really handy there: it requires typing the path, while my workflow with "git add -p" does not, and it wouldn't show the combined diff, which is usually the best tool to see if a merge has been resolved properly.

The current behavior is not that bad for me: I see the combined diff in the output, I just have one extra "git add $path" to type. Being able to just say "y" instead would be handy, but not fundamentally different.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Holger HellmuthNext: Junio C Hamano
Message 17 of 21 in “git add -p and unresolved conflicts”
  1. Erik Faye-LundMar 28, 2012
  2. Junio C HamanoMar 28, 2012
  3. Matthieu MoyMar 28, 2012
  4. Holger HellmuthMar 28, 2012
  5. Junio C HamanoMar 28, 2012
  6. Holger HellmuthMar 28, 2012
  7. Jeff KingMar 29, 2012
  8. Holger HellmuthMar 29, 2012
  9. Matthieu MoyMar 28, 2012
  10. Junio C HamanoMar 28, 2012
  11. Holger HellmuthMar 28, 2012
  12. Junio C HamanoMar 28, 2012
  13. Holger HellmuthMar 28, 2012
  14. Junio C HamanoMar 28, 2012
  15. Junio C HamanoMar 28, 2012
  16. Holger HellmuthMar 29, 2012
  17. Matthieu MoyMar 29, 2012
  18. Junio C HamanoMar 29, 2012
  19. Matthieu MoyMar 30, 2012
  20. Erik Faye-LundMar 28, 2012
  21. Junio C HamanoMar 28, 2012

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.