1GIT-LFS-MERGE-DRIVER(1)                                GIT-LFS-MERGE-DRIVER(1)
2
3
4

NAME

6       git-lfs-merge-driver - Merge text-based LFS files
7

SYNOPSIS

9       git lfs merge-driver [options]
10

DESCRIPTION

12       Merge text files stored in Git LFS using the default Git merge
13       machinery, or a custom merge driver if specified. Note that this, in
14       general, does not support partial renames or copies because Git does
15       not support them in this case.
16
17       This program is intended to be invoked automatically by Git and not by
18       users manually. See CONFIGURATION for details on the configuration
19       required for that.
20

OPTIONS

22       --ancestor <path>
23           Specify the file containing the ancestor revision.
24
25       --current <path>
26           Specify the file containing the current revision.
27
28       --marker-size <num>
29           Specify the conflict marker size as an integer.
30
31       --other <path>
32           Specify the file containing the other revision.
33
34       --program <program>
35           Specify a command, which is passed to the shell after substitution,
36           that performs the actual merge. If this is not specified, git
37           merge-file is invoked with appropriate arguments to perform the
38           merge of the file.
39
40           See CONFIGURATION for the sequences which are substituted here.
41

CONFIGURATION

43       Git allows the use of a custom merge driver for files based on the
44       merge attribute set in .gitattributes. By default, when using git lfs
45       track, this value is set to lfs.
46
47       Because Git LFS can be used to store both text and binary files and it
48       isn’t always clear which behavior should be used, Git LFS does not
49       enable this merge driver by default. However, if you know that some or
50       all of your files are text files, then you can set the merge attribute
51       for those files to lfs-text and use git config to set the merge driver
52       like so:
53
54           $ git config merge.lfs-text.driver 'git lfs merge-driver --ancestor %O --current %A --other %B --marker-size %L --output %A'
55
56       This tells Git to invoke the custom Git LFS merge driver, which in turn
57       uses Git’s merge machinery, to merge files where the merge attribute is
58       set to lfs-text. Note that lfs-text here is an example and any
59       syntactically valid value can be used.
60
61       If you are using a special type of file that needs rules different from
62       Git’s standard merge machinery, you can also specify the --program
63       option, which is passed to sh after substituting its own
64       percent-encoded escapes:
65
66       •   %A: the current version
67
68       •   %B: the other version
69
70       •   %D: the destination version
71
72       •   %O: the ancestor version
73
74       •   %L: the conflict marker size
75
76       Note that the percent sign must typically be doubled to prevent Git
77       from substituting its own values here. Therefore, specifying the
78       default behavior explicitly looks like this:
79
80           $ git config merge.lfs-text.driver \
81             'git lfs merge-driver --ancestor %O --current %A --other %B --marker-size %L --output %A --program '\''git merge-file --stdout --marker-size=%%L %%A %%O %%B >%%D'\'''
82
83       The exit status from the custom command should be zero on success or
84       non-zero on conflicts or other failure.
85
86       Note that if no merge driver is specified for the value of the merge
87       attribute (as is the case by default with merge=lfs), then the default
88       Git merge strategy is used. For LFS files, this means that Git will try
89       to merge the pointer files, which usually is not useful.
90

SEE ALSO

92       git-merge(1), git-merge-file(1), gitattributes(5)
93
94       Part of the git-lfs(1) suite.
95
96
97
98                                                       GIT-LFS-MERGE-DRIVER(1)
Impressum