JJ VCS(aka Jujutsu) official workflow guide also my git notes

Config

# configure jj 
jj config set --user user.name "Anton"
jj config set --user user.email "[email protected]"
jj config edit --user
# (or via )
nvim ~/.config/jj/config.toml

Also no pager flag is great

--no-pager
# or set it permanently
jj config set --user ui.paginate never

set up git repo tracking

# set up jj repo and track trunk. jj bookmark is like a branch
jj git init --colocate
jj bookmark track master@origin

make changes

echo "some stufff" >> README.md
# this will be saved in a separate commit on top of master, which will be constantly amended to reflect you WIP

# in order to push you need a commit message
jj describe

Push

# update parent/trunk
jj git fetch
# rebase current commit to main
jj rebase -s @ -d master

# move main bookmark
jj bookmark set master
jj git push

conflict for JJ from GitHub web UI


Alieased and templates

nvim ~/.config/jj/config.toml

lint, rebase all

[aliases]
lint = ["util", "exec", "--", "bash", "-c", """
set -euo pipefail
if [ -d script ]; then
  DIR=script
elif [ -d scripts ]; then
  DIR=scripts
else
  echo "Neither 'script' nor 'scripts' directory exists." >&2
  exit 1
fi

"$DIR"/commitlint -v --from origin/main --to $(jj log -r @ -T 'commit_id' --no-graph)
""", ""]

rebase-all = ["rebase", "-s", "roots(trunk()..mutable())", "-d", "trunk()"]

[templates]
git_push_bookmark = '"anton/" ++ change_id.short()'

Leave a comment