Hi there, I am brand new to Pijul as of the last 48 hours… I’ve read all the docs, a bunch of forum posts, watched some vids on YouTube, and have been experimenting.
My big caveat: I’ve been using git pretty much daily for 16+ years. Please be patient with me as I try to wrap my head around the Pijul model
There’s a code workflow that’s fairly common, that git makes quite painful. I’d like to know if I can accomplish the desired result with Pijul.
In short, it is:
- make a bunch of commits on a branch
- squash some of the intermediate commits
It’s not a problem if I’m the person doing it, and it’s all in my local workspace. The problem arises when someone else creates a messy history, and I want to clean it up, but keep some later commits.
Similarly, it can occur if two people independently create the same commit.
(and now I will switch to Pijul terminology)
For a slightly more specific scenario:
- I record a good change
- Joe records two messy changes, but good state
- I record that same good state as a good change
- Joe records a new change on top of his messy changes
I want Joe to replace his messy changes with my good one, and maintain his new work (i.e. rebase).
Here’s a script that illustrates the scenario (pijul 1.0.0-beta.9
):
#!/bin/sh
set -eu
rm -rf demo
pijul init demo
cd demo
echo "line 1" >> myfile
pijul add myfile
pijul record -a -m "add line 1"
pijul fork joe-fork
echo "line 2" >> myfile
pijul record -a -m "add line 2 in joe-fork" --channel joe-fork
echo "line 3" >> myfile
pijul record -a -m "add line 3 in joe-fork" --channel joe-fork
pijul record -a -m "add lines 2,3 in main"
echo "line 4" >> myfile
pijul record -a -m "add line 4 in joe-fork" --channel joe-fork
pijul pull -a --to-channel joe-fork .
pijul reset .
pijul channel switch joe-fork
cat myfile
This produces the following output:
Tracked 1 path(s)
Hash: GJDJIVG6DFXJQ65CEBLRWKZDVUMLJSXGCC2FT7X4ZCP36SBVLM5QC
Hash: BMXON7WXENSKWWC2AB53RAVIOA6G5C5CY7TTZBN2PUUA5SUODYSQC
Hash: BNN3LIPZ5QLOS6MFN4GDZ246MAF7HBYRT72YIGGGXNUE7DSZVL5QC
Hash: UVSEJM7N2ICMB35CQ523RAS5UNNHHR5PROIY7I6UKFHUJ2HTOV7QC
Hash: 26HQBCNUR2WBWM2ZAHOCDTYRV46FJUCTTF6YJ3PKHMOTEEXSNR7AC
Downloading changes [==================================================] 1/1 [00:00:00]
Applying changes [==================================================] 1/1 [00:00:00]
Downloading changes [==================================================] 1/1 [00:00:00]
Completing changes... done!
Outputting repository... done!
Reset given paths to last recorded change
Outputting repository... done!
There were conflicts:
- Order conflict in "myfile" starting on line 2
Reset given paths to last recorded change
line 1
>>>>>>> 1 [BMXON7WX add line 2 in joe-fork]
line 2
line 3
line 4
======= 1 [UVSEJM7N add lines 2,3 in main]
line 2
line 3
<<<<<<< 1
The question
How do we get joe-fork
into this nice, clean set of changes?
- “add line 1”
- “add lines 2,3 in main”
- “add line 4 in joe-fork”