2021-10-22 23:56:30 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
2023-08-29 01:42:44 +03:00
|
|
|
. "$(dirname "$0")"/helpers.sh
|
2021-10-22 23:56:30 +03:00
|
|
|
|
|
|
|
new_tmp_dir
|
2023-08-29 08:59:58 +03:00
|
|
|
jj git clone https://github.com/octocat/Hello-World > /dev/null
|
2021-10-22 23:56:30 +03:00
|
|
|
cd Hello-World
|
|
|
|
|
2022-10-21 08:13:09 +03:00
|
|
|
comment "We are in the octocat/Hello-World repo.
|
|
|
|
We have an empty working copy on top of master:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "jj status"
|
2021-10-28 06:38:56 +03:00
|
|
|
run_command "jj log"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Now make some changes in the working copy:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "echo \"Goodbye World!\" > README"
|
|
|
|
run_command "echo stuff > new-file"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Our working copy's commit ID changed
|
|
|
|
because we made changes:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "jj status"
|
2021-10-28 06:38:56 +03:00
|
|
|
run_command "jj log"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Add a branch so we can easily refer to this
|
|
|
|
commit:"
|
2022-06-09 23:58:34 +03:00
|
|
|
run_command "jj branch create goodbye"
|
2021-10-28 06:38:56 +03:00
|
|
|
run_command "jj log"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Start working on a new change off of master:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "jj co master"
|
2021-10-28 06:38:56 +03:00
|
|
|
run_command "jj log"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Note that the working copy is now clean; the
|
|
|
|
\"goodbye\" change stayed in its own commit:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "jj status"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Modify a file in this new change:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "echo \"Hello everyone!\" > README"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "The working copy is not special; we can, for
|
|
|
|
example, set the description of any commit.
|
|
|
|
First, set it on the working copy:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "jj describe -m everyone"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Now set it on the change we worked on before:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "jj describe goodbye -m goodbye"
|
2022-10-21 08:13:09 +03:00
|
|
|
|
|
|
|
comment "Inspect the result:"
|
2021-10-22 23:56:30 +03:00
|
|
|
run_command "jj log"
|
2023-02-09 03:26:55 +03:00
|
|
|
|
|
|
|
blank
|