3
3
The Composer JSON Git Merge Driver provides a mechanism to more effectively merge
4
4
` composer.json ` and ` composer.lock ` files that have been modified simultaneously
5
5
in separate branches / development histories. The [ custom git merge driver] [ merge driver ]
6
- is activated when the composer JSON files require a merge more complex than a
7
- simple "fast forward".
6
+ is invoked when the composer JSON files require a merge more complex than a
7
+ simple "fast forward."
8
8
9
9
## How it Works
10
10
@@ -46,30 +46,29 @@ the real hash!
46
46
47
47
## Installation
48
48
49
- The merge driver can be installed globally or per repo and activated globally or per repo,
49
+ The merge driver can be installed globally or per repo and configured and activated globally or per repo,
50
50
i.e. you can install the driver globally but only activate it on certain projects.
51
51
52
- ### 1. Download the merge driver.
52
+ ### 1. Install the merge driver on your system .
53
53
54
- Use composer to install the driver into your repo or globally.
54
+ Use composer to install the driver globally:
55
55
56
56
``` sh
57
- $ composer require --dev balbuf/composer-git-merge-driver
57
+ $ composer global require balbuf/composer-git-merge-driver
58
58
```
59
59
60
- or
60
+ or just in a particular repo:
61
61
62
62
``` sh
63
- $ composer global require balbuf/composer-git-merge-driver
63
+ $ composer require --dev balbuf/composer-git-merge-driver
64
64
```
65
65
66
- ### 2. Install the merge driver.
66
+ Note that if you are installing the driver via the latter (per repo) method, this will be added
67
+ to the repo's ` composer.json ` and thus will be installed as a dependency for all users of the repo.
68
+
69
+ ### 2. Configure the merge driver with git.
67
70
68
- The driver is installed by informing git of its existence via a [ git config] [ git config ]
69
- file. This example assumes that your path includes
70
- ` ~/.composer/vendor/bin ` (for global installation) or ` ./vendor/bin `
71
- (for repo installation.) If that is not so, update the path to the
72
- driver on the ` driver ` line.
71
+ The driver is made available for use by informing git of its existence via a [ git config] [ git config ] file:
73
72
74
73
```
75
74
[merge "composer_json"]
@@ -88,13 +87,15 @@ By default, this allows you to edit the config file for the current repo, meanin
88
87
is only installed locally to the repo. To edit the global config file for your user, append the
89
88
` --global ` flag; to edit the system-wide config file, append the ` --system ` flag.
90
89
91
- Copy and paste the block above into the config file and save it. Be sure to update the path if
92
- you downloaded the file to somewhere other than ` ~/composer-git-merge-driver.php ` . If you moved the
93
- file somewhere in your ` $PATH ` , you can simply replace the path with ` composer-git-merge-driver ` .
90
+ Copy and paste the block above into the config file and save it. This example assumes that your ` $PATH `
91
+ includes [ Composer's vendor bin] [ vendor bin ] path (by default, ` ~/.composer/vendor/bin ` for global
92
+ installation or ` ./vendor/bin ` for repo installation). If not, be sure to update your ` $PATH ` or
93
+ add the appropriate path to the binary on the ` driver ` line.
94
94
95
95
For more information about git config files, refer to the [ git documentation] [ git config ] .
96
96
97
97
[ git config ] : https://git-scm.com/docs/git-config
98
+ [ vendor bin ] : https://getcomposer.org/doc/articles/vendor-binaries.md#can-vendor-binaries-be-installed-somewhere-other-than-vendor-bin-
98
99
99
100
### 3. Activate the merge driver.
100
101
@@ -140,7 +141,7 @@ and the merge completed, you can avoid creating an additional commit by amending
140
141
``` sh
141
142
$ composer update --lock
142
143
$ git add composer.lock
143
- $ git commit --amend
144
+ $ git commit --amend --no-edit
144
145
```
145
146
146
147
## Additional Information
0 commit comments