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

Commit dates on conflict markers

From
RLRoger Light <roger@atchoo.org>
Date
Sep 11, 2023, 21:02 UTC
Message-ID
<CAH7zdydYgSf+21GB70=gRhEcupv4e1ix==7LWCeQYgpD-1Rcmw@mail.gmail.com>
Hello,

When I carry out a merge with conflicts, it's not always clear when resolving the conflicts which is the correct part of code to use. I sometimes use git blame to guide me as to the age of the different chunks of code and hence what to choose.

I was wondering if there might be a way to help include that sort of information directly into the conflict.

If you had a single line conflict it would be straightforward to display by including the date the line was last modified alongside the conflict marker:

<<<<<<< HEAD date:yesterday print("please") ======= date:10 years ago print("help")

>>>>>>> main

With a more realistic change with multiple lines and context from different commits, it's not immediately obvious to me that it's possible to do in a way that isn't completely horrible.

I am in no way a git expert though, so I thought I'd ask and see what you thought.

Regards,
Roger
Next: Junio C Hamano
Message 1 of 4 in “Commit dates on conflict markers”
  1. Roger LightSep 11, 2023
  2. Junio C HamanoSep 11, 2023
  3. Jeff KingSep 12, 2023
  4. Elijah NewrenSep 12, 2023

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.