mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-28 17:41:14 +00:00
986fced69e
The demos don't need to be animated - the user wouldn't miss anything if they skipped to the end. So let's just show the full output so the user can read through it at their own pace. We could use plain text, but I think the colors are helpful, so I went with screenshots. Closes #166.
46 lines
1.2 KiB
Bash
Executable file
46 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
. "$(dirname "$0")"/demo_helpers.sh
|
|
|
|
new_tmp_dir
|
|
jj init
|
|
echo "first" > file
|
|
jj branch create first
|
|
jj close -m 'first'
|
|
echo "second" > file
|
|
jj branch create second
|
|
jj close -m 'second'
|
|
echo "third" > file
|
|
jj branch create third
|
|
jj close -m 'third'
|
|
|
|
comment "We are in a repo with three commits, all
|
|
editing the same line:"
|
|
run_command "jj log"
|
|
|
|
run_command "jj diff -r first"
|
|
run_command "jj diff -r second"
|
|
run_command "jj diff -r third"
|
|
|
|
comment "Let's reorder the second and third commits:"
|
|
run_command "jj rebase -s third -d first"
|
|
run_command "jj rebase -s second -d third"
|
|
run_command "jj log"
|
|
comment "The commit labeled \"third\" has a conflict,
|
|
as expected. What's more interesting is
|
|
that the top commit has no conflict! That's
|
|
because it has the changes from all three
|
|
commits applied to it."
|
|
|
|
comment "Let's verify that by looking at its contents:"
|
|
run_command "jj co second"
|
|
run_command "cat file"
|
|
|
|
comment "Let's now instead make \"second\" and \"third\"
|
|
sibling and merge them:"
|
|
run_command "jj rebase -s second -d first"
|
|
run_command "jj merge second third -m merged"
|
|
run_command "jj log"
|
|
comment "Again, because the merge commit has the
|
|
changes from all three commits, it has no
|
|
conflict."
|