Many software projects feature a
ChangeLog) file where the most
important changes are documented.
One way of maintaining such a file is to request an entry for each contribution.
However, this bears potential for merge conflicts: Two separate
contributions will then change the
NEWS file in the same place and thus are
Are they really?
In Git, there are three built-in merge drivers:
textfor text files: Will merge non-conflicting changes and introduce the notorious conflict markers
>>>>>>>for conflicting changes
binaryfor binary files: Will prefer "our" contents and mark the file as conflicted
unionfor text files: Will append lines introduced by conflicting changes in a random order
binary driver is used, depending on the file type.
NEWS file, the
union driver would be ideal.
It is possible to specify a merge driver for each file in the repository
This is done by adding an entry to the
file in the root of the repository, in our case
Create the file if it does not exist.
/NEWS is the absolute path of the
NEWS file in the repository.
Don't forget to commit this file to the repository.
After that, entries added to the
NEWS file by different branches all appear
in the resulting file after merging, ready for being sorted just before the
I have prepared a small demo
It seems that this feature has been around forever, but it is not as widely
known as, say, the
One more hint: If new items are added to the top of the
NEWS file, the order
of the entries will match the (reverse) order in which the branches are merged.