# Good merge, bad merge
Posted on
Some time ago, I became interested in a new VCS called Pijul
$ 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/XYZ/' 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
XYZ
D
E
G
G
G
A
B
C
D
E
$ 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/XYZ/' 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
XYZ
D
E
git init |
pijul init |
git commit -a -m |
pijul record -m |
git checkout -b foo start-point | pijul fork foo --channel start-point pijul channel switch foo |
git merge bar |
pijul log --channel bar (to find hashes to apply) pijul apply hash |