Creating a new repository:
$ jj git init .
Initialized repo in "."
$ jj log
@ unsmxwsn pm@mkz.me 2024-08-21 20:19:59 8f89d5bb
│ (no description set)
◆ zzzzzzzz root() 00000000
Note: Modifying the file will "prepare" a new git commit, changing the git commit id but not the working copy id:
$ jj log
@ unsmxwsn pm@mkz.me 2024-08-21 20:23:45 d91b14ec
│ (no description set)
◆ zzzzzzzz root() 00000000
Setting a description to current working copy:
$ jj describe -m "creating a basic README"
Working copy now at: unsmxwsn 552a06d1 creating a basic README
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
Sharing the working copy on github:
$ jj git remote add origin git@github.com:mycroft/test-jj.git
$ jj branch set trunk --allow-backwards
Created 1 branches pointing to unsmxwsn 75d5fa62 trunk | creating a basic README
Hint: Consider using `jj branch move` if your intention was to move existing branches.
$ jj git push
Branch changes to push to origin:
Add branch trunk to 75d5fa62e3cf
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: vnwzwwsn f2a1594d (empty) (no description set)
Parent commit : unsmxwsn 75d5fa62 trunk | creating a basic README
Updating with a new commit
$ jj new
$ jj describe -m README: updating trunk/github"
... updating README ...
$ jj squash
! will not work as parent commit is immutable (was pushed to git!)
$ jj branch set trunk
Moved 1 branches to zxkqtlpv fb9d5a5b trunk* | README: updating trunk/github
$ jj git push
Branch changes to push to origin:
Move forward branch trunk from c077201cc545 to 8a31d71ba508
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy now at: zklmpuzq f878d686 (empty) (no description set)
Parent commit : zxkqtlpv 8a31d71b trunk | README: updating trunk/github
As work was shared/pushed to github, a new working copy is created.
The workflow works like this:
- set a description about what's to be done
jj describe -m "README: describing squash workflow"
- create a new working copy
jj new
- At this moment, the parent commit will be empty (ie: no diff)
- once work is complete, squash the working commit into the parent commit.
jj squash
As squash will merge current changes into the parent commit, it is possible to do that multiple time! The parent commit will not change (unlike the git's commit id obviously). jj squash
works as git commit --amend
.