jj/demos/demo_resolve_conflicts.sh
Ilya Grigoriev a70ea9dfdc demos: rearrange and reword portions of demos
This is mainly to account for the fact that most commands now report
more information about the state of the repo.
2023-10-03 23:52:28 -07:00

45 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
. "$(dirname "$0")"/helpers.sh
new_tmp_dir
jj git clone https://github.com/octocat/Hello-World > /dev/null
cd Hello-World
comment "We are on the master branch of the
octocat/Hello-World repo:"
run_command "jj log -r 'all()'"
comment "Let's make an edit that will conflict
when we rebase it:"
run_command "jj describe -m \"README: say which world\""
run_command "echo \"Hello Earth!\" > README"
run_command "jj diff"
# TODO(ilyagr): Get the real shortest prefix of the b1b commit using `jj log
# --no-graph` and the `.shortest()` template function.
#
# This could also be done in demo_git_compat.sh, but that might not be worth it.
comment "We're going to rebase it onto commit b1.
That commit looks like this:"
run_command "jj diff -r b1"
comment "Now rebase:"
run_command "jj rebase -d b1"
comment "That seemed to succeed but we are also told there is now a conflict.
Let's take a look at the repo:"
run_command "jj log -r 'all()'"
run_command "jj status"
comment "Indeed, the rebased commit has a conflict. The conflicted file
in the working copy looks like this:"
run_command "cat README"
comment "Now we will resolve the conflict:"
run_command "echo \"Hello earth!\" > README"
comment "The status command no longer reports it:"
run_command "jj status"
blank