## Git
Let's create a simple bad merge with Git:
$ git --version
git version 2.35.1
$ git init merge-git
$ cd merge-git
# Create and record our initial change (a)
$ python -c "print('\n'.join(c for c in 'ABCDE'))" > file.txt
$ git add file.txt
$ git commit -m 'a'
# Creates changes b1 and b2
$ git checkout -b b
# Change b1
$ python -c "print('\n'.join(c for c in 'GGGABCDE'))" > file.txt
$ git commit -a -m 'b1'
# Change b1
$ python -c "print('\n'.join(c for c in 'ABCDEGGGABCDE'))" > file.txt
$ git commit -a -m 'b2'
# Create change c1
$ git checkout -b c master
$ sed -i -e 's/C/X/' file.txt
$ git commit -a -m 'c1'
# Now we merge c1 into b2
$ git checkout -b merge b
$ git merge c
Auto-merging file.txt
Merge made by the 'ort' strategy.
file.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
$ cat file.txt
A
B
X
D
E
G
G
G
A
B
C
D
E
## Pijul
Let's try the same sequence with Pijul.
$ pijul --version
pijul 1.0.0-beta.2
$ pijul init merge-pijul
$ cd merge-pijul
$ python -c "print('\n'.join(c for c in 'ABCDE'))" > file.txt
$ pijul add file.txt
$ pijul record -m 'a'
$ pijul fork b
$ pijul channel switch b
$ python -c "print('\n'.join(c for c in 'GGGABCDE'))" > file.txt
$ pijul record -m b1
$ python -c "print('\n'.join(c for c in 'ABCDEGGGABCDE'))" > file.txt
$ pijul record -m b2
$ pijul fork c --channel main
$ pijul channel switch c
$ sed -i -e 's/C/X/' file.txt
$ pijul record -m 'c1'
$ pijul fork merge --channel b
$ pijul channel switch merge
$ pijul apply "$(pijul log --channel c |head -1 | cut -d' ' -f2)"
$ cat file.txt
A
B
C
D
E
G
G
G
A
B
X
D
E