4

When using a custom driver for merging in Git what is the full file path of the Git attributes /arguments you pass to the driver?

Ex:

driver = filfre %O %A %B

What is the full file path of the three files, %O, %A, and %B?

-Tanner

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Tanner
  • 81
  • 1
  • 4

1 Answers1

2

You can follow the example I posted about How do I tell git to always select my local version for conflicted merges on a specific file?.

That scenario involves a merge driver, which you can tweak to display those three variable.

keepmine.sh

echo
echo origin $1
echo origin content:
cat $1
echo
echo local  $2
echo local content:
cat $2
echo
echo remote $3
echo remote content:
cat $3
exit 0

Here what it returned to me:

C:\Prog\Git\tests\CopyMerge>git merge hisBranch

origin .merge_file_a08152
origin content:
  b

local .merge_file_b08152
local content:
  b
  myLineForB

remote .merge_file_c08152
remote content:
  b
  hisLineForB

So in this instance, it appears to be generating three local temp files, names merge_file_xxx.


As mentioned by BlackEye in the comment and in BlackEye's answer "Git Merge Driver - How to find out full path of merged file?", commit ef45bb1 introduced (git 2.5, July 2015) the original path to external drivers with %P.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • But there should be a way to retrieve the original file path I think. What about today, 5 years later? Any suggestion? – BlackEye Jun 01 '15 at 14:14
  • The original file path can now (since 2.5) be passed to the merge driver using the parameter %P. – BlackEye Feb 18 '16 at 09:32
  • @BlackEye Good find! I have included your comment in the answer for more visibility. – VonC Feb 18 '16 at 09:38