2

I got conflict: enter image description here

Is there an option to show last commit hash for changes at HEAD (green underline).

I expect this: HEAD, 476ce2c Simplify interface: remove 'rs' parameter
which will be similar to >>>>>>> section

Eugen Konkov
  • 18,498
  • 11
  • 88
  • 126

1 Answers1

5

You could in-place replace it yourself

find ./ \( -type d -name .git -prune \) -o -type f -print0 | xargs \
    sed -i "s/<<<<<<<< HEAD/<<<<<<<< $(git rev-parse --short HEAD)/"

Consider git log --pretty=reference -n 1 head as the command (git rev-parse --short is just the short hash) or refer to the docs to build exactly what you want as git log --pretty=format:"whatever you like" -n 1 head https://git-scm.com/docs/pretty-formats

find|xargs modified from top answer to How to do a recursive find/replace of a string with awk or sed?

ti7
  • 12,648
  • 6
  • 30
  • 60
  • Also note that while this should work for the general case, I'm not absolutely certain it behaves as-expected during a merge, and I'm hoping for a better answer! – ti7 Mar 30 '21 at 19:05