27 ms·
Note that three-way merge is much older than git. It's implemented by the diff3 program, which was part of Version 7 Unix from 1979 on, and the same algorithm i
by not2b 3y ago
Note that three-way merge is much older than git. It's implemented by the diff3 program, which was part of Version 7 Unix from 1979 on, and the same algorithm is used by CVS, Perforce, and pretty much any other revision control system. The GNU version is part of diffutils, and of course there's also a BSD version.
- deleted 3y ago[deleted]
- crdrost 3y agoNote also that three-way merge is not an associative operation which can sometimes lead to some surprising behaviors, https://winddy.buzz/manual/why_pijul.html https://winddy.buzz/manual/why_pijul.html
- not2b 3y agoA major source of conflicts I see in development might be resolved if we had something like a four-way merge. Consider this case: we have a base version, and two changes have been applied to that version. Change 1 adds a function at a given position in a file. Change 2 adds a different function at the same position. But we want both functions to exist in the final result. Suppose the release branch starts with the release version, and then change 2 is merged. Now we try to merge change 1. We get a conflict because the merge is at the same point. But if we could look at a fourth input (the state of the file on the development branch, or at the earliest state that has both change 1 and change 2 as predecessors), we could see that the resolution is to add both functions, in the order matching the order in the development branch. The four cases being considered are: the base version; the v1 change version (base + v1), the v2 change version (base + v2), and the earliest version that has both changes already applied.
- loeg 3y agoThe BSD version is sort of very recent, for what it's worth -- FreeBSD imported a not fully functional version in 2017 and has seen more work on it in 2022: https://github.com/freebsd/freebsd-src/commits/main/usr.bin/diff3/diff3.c https://github.com/freebsd/freebsd-src/commits/main/usr.bin/... , but the default version shipped is still GNU diff3 from ~2007 (before the GPL3): https://man.freebsd.org/cgi/man.cgi?query=diff3&apropos=0&sektion=1&manpath=FreeBSD+15.0-CURRENT&arch=default&format=html https://man.freebsd.org/cgi/man.cgi?query=diff3&apropos=0&se... .
- not2b 3y agoI wasn't aware of that. Perhaps they never re-implemented the version from Bell Labs so they didn't have a free program (other than the GNU one) that they could release until more recently?