mirror of
https://github.com/martinvonz/jj.git
synced 2024-09-11 13:56:29 +03:00
demos: add demo of automatic working copy commit
This commit is contained in:
parent
f72e53376f
commit
74e21acd02
@ -45,6 +45,13 @@ Features:
|
|||||||
changes (you can even check out a different commit while resolving merge
|
changes (you can even check out a different commit while resolving merge
|
||||||
conflicts).
|
conflicts).
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Demo</summary>
|
||||||
|
<a href="https://asciinema.org/a/k2V5ePk89kQZg7HAGaELkl2qo" target="_blank">
|
||||||
|
<img src="https://asciinema.org/a/k2V5ePk89kQZg7HAGaELkl2qo.svg" />
|
||||||
|
</a>
|
||||||
|
</details>
|
||||||
|
|
||||||
* **Operations update the repo first, then possibly the working copy**
|
* **Operations update the repo first, then possibly the working copy**
|
||||||
|
|
||||||
The working copy is only updated at the end of an operation, after all other
|
The working copy is only updated at the end of an operation, after all other
|
||||||
|
44
demos/demo_working_copy.sh
Executable file
44
demos/demo_working_copy.sh
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
. "$(dirname "$0")"/demo_helpers.sh
|
||||||
|
parse_args "$@"
|
||||||
|
|
||||||
|
new_tmp_dir
|
||||||
|
jj git clone https://github.com/octocat/Hello-World
|
||||||
|
cd Hello-World
|
||||||
|
|
||||||
|
run_demo 'The working copy is automatically committed' '
|
||||||
|
run_command "# We are in the octocat/Hello-World repo."
|
||||||
|
run_command "# We have an empty working copy on top of master:"
|
||||||
|
run_command "jj log"
|
||||||
|
sleep 5
|
||||||
|
run_command "jj status"
|
||||||
|
sleep 2
|
||||||
|
run_command "# Now make some changes in the working copy:"
|
||||||
|
run_command "echo \"Goodbye World!\" > README"
|
||||||
|
run_command "echo stuff > new-file"
|
||||||
|
run_command "# Our working copy commit id changed because we made changes:"
|
||||||
|
run_command "jj status"
|
||||||
|
sleep 5
|
||||||
|
run_command "# Add a branch so we can easily refer to this commit:"
|
||||||
|
run_command "jj branch goodbye"
|
||||||
|
sleep 2
|
||||||
|
run_command "# Start working on a new change off of master:"
|
||||||
|
run_command "jj co master"
|
||||||
|
sleep 2
|
||||||
|
run_command "# Note that the working copy is now clean; the \"goodbye\" change stayed in its own commit:"
|
||||||
|
run_command "jj status"
|
||||||
|
sleep 5
|
||||||
|
run_command "# Modify a file in this new change:"
|
||||||
|
run_command "echo \"Hello everyone!\" > README"
|
||||||
|
sleep 2
|
||||||
|
run_command "# The working copy is not special; we can, for example, set the description of any commit."
|
||||||
|
run_command "# First, set it on the working copy:"
|
||||||
|
run_command "jj describe -m everyone"
|
||||||
|
sleep 2
|
||||||
|
run_command "# Now set it on the change we worked on before:"
|
||||||
|
run_command "jj describe goodbye -m goodbye"
|
||||||
|
sleep 2
|
||||||
|
run_command "# Inspect the result:"
|
||||||
|
run_command "jj log"
|
||||||
|
'
|
Loading…
Reference in New Issue
Block a user