ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/demos/demo_git_compat.sh
Ilya Grigoriev 51c374e917 demo git_compat and README: repurpose the demo somewhat
It is important to mention tracking branches and listing branches. This topic is important now that `jj log` does not show branches
`jj git clone` says it fetched by default. 

The demo has become more about navigating a Git remote, so I reworded
the README accordingly, shifting the focus more to "Git remote
compatibility" and away from "We include a Git repo". Both are
important, but these skills seem important for beginners.
2024-09-05 17:33:46 -07:00

36 lines
1 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
. "$(dirname "$0")"/helpers.sh
new_tmp_dir
comment "Clone a Git repo:"
run_command "jj git clone https://github.com/octocat/Hello-World"
run_command "cd Hello-World"
blank
comment "By default, \"jj\" creates a local master branch tracking the remote master
branch. The other branches are only available as remote-tracking branches."
run_command "jj branch list --all"
comment "We can create a local branch tracking one of the remote branches we just
fetched."
run_command "jj branch track octocat-patch-1@origin"
comment "By default, \"jj log\" excludes untracked remote branches to focus on
\"our\" commits."
run_command "jj log"
comment "We can also ask \"jj\" to show all the commits."
run_command "jj log -r 'all()'"
comment "We can look at the diffs of commits in the repo"
run_command "jj diff -r b1"
blank
run_command "jj diff -r b3"
comment "The repo is backed by the actual Git repo:"
run_command "git --git-dir=.jj/repo/store/git log --graph --all --decorate --oneline"
blank