-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This updates the code blocks in chapters "Branching, merging, and conflicts" and "Sharing your code with others" following the deprecation of `jj branch` in jj 0.22 (branches got renamed to bookmarks): https://github.com/martinvonz/jj/blob/main/CHANGELOG.md#0220---2024-10-02 As of jj 0.22, using `remote_branches()` produces a deprecation warning: remote_branches() is deprecated; use remote_bookmarks() instead Similarly for `jj branch`: Warning: `jj branch` is deprecated; use `jj bookmark` instead, which is equivalent Warning: `jj branch` will be removed in a future version, and this will be a hard error The following changes were made in the code blocks, based on repeating the walkthrough: - remote_branches() -> remote_bookmarks() - jj branch -> jj bookmark - Include (new?) output of jj bookmark set - Include (new?) output of jj git fetch - Update output of jj git push: "force branch" -> move sideways bookmark (and the like) - Update output of commands which mentioned branches Note: if the changed command output included change / revision identifiers, these were hand-adjusted to match those appearing elsewhere in text wherever possible, keeping things consistent. With few exceptions this does not update the narrative, so the text still talks about branches.
- Loading branch information
1 parent
694462e
commit dd8eaca
Showing
4 changed files
with
34 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# Using named branches in `jj` | ||
|
||
Named branches are mostly an interoperability feature in `jj`; other than some | ||
Named branches (or, starting with `jj 0.22`, "bookmarks") are mostly an interoperability feature in `jj`; other than some | ||
sort of "main branch" that indicates where shared history lives, other branches | ||
aren't necessary to get work done. However, if you use a tool like GitHub, which | ||
bases a lot of its functionality around `git` branches, then you'll end up using | ||
more than one named branch. | ||
|
||
To create a named branch in `jj`, we can use `jj branch create`: | ||
To create a named branch (bookmark) in `jj`, we can use `jj bookmark create`: | ||
|
||
```console | ||
$ jj branch create trunk | ||
$ jj bookmark create trunk | ||
$ jj log --limit 2 | ||
@ povouosx [email protected] 2024-03-01 18:12:43.000 -06:00 trunk f68d1623 | ||
│ remove goodbye message | ||
|
@@ -70,7 +70,8 @@ behavior is a bit surprising for folks coming from `git`, though it fits in with | |
Regardless, let's update `trunk` to point at `@`: | ||
|
||
```console | ||
$ jj branch set trunk | ||
$ jj bookmark set trunk | ||
Moved 1 bookmarks to pzkrzopz fcf669c5 trunk | (empty) (no description set) | ||
$ jj log --limit 2 | ||
@ pzkrzopz [email protected] 2024-03-01 22:41:37.000 -06:00 trunk fcf669c5 | ||
│ (empty) (no description set) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,8 @@ do that like this: | |
$ jj edit @- | ||
Working copy now at: povouosx f68d1623 remove goodbye message | ||
Parent commit : vvmrvwuz d41c079b refactor printing | ||
$ jj branch set trunk --allow-backwards | ||
$ jj bookmark set trunk --allow-backwards | ||
Moved 1 bookmarks to povouosx f68d1623 | remove goodbye message | ||
$ jj abandon pzkrzopz | ||
Abandoned commit pzkrzopz fcf669c5 (empty) (no description set) | ||
$ jj log --limit 2 | ||
|
@@ -49,8 +50,11 @@ Anyway, let's push `trunk` up to GitHub: | |
|
||
```console | ||
$ jj git push | ||
Branch changes to push to origin: | ||
Add branch trunk to f68d16233bdc | ||
Changes to push to origin: | ||
Add bookmark trunk to f68d16233bdc | ||
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: znurnwmk f853107d (empty) (no description set) | ||
Parent commit : povouosx f68d1623 | remove goodbye message | ||
``` | ||
|
||
And now our project is up on GitHub! | ||
|
@@ -73,17 +77,20 @@ Let's fetch those changes: | |
|
||
```console | ||
$ jj git fetch | ||
bookmark: trunk@origin [updated] tracked | ||
$ jj log --limit 3 | ||
◉ ksrmwuon [email protected] 2024-03-01 23:10:35.000 -06:00 trunk e202b67c | ||
│ Update Cargo.toml | ||
│ @ znurnwmk [email protected] 2024-03-01 18:15:00.000 f853107d | ||
├─╯ (empty) (no description set) | ||
@ povouosx [email protected] 2024-03-01 18:12:43.000 -06:00 f68d1623 | ||
│ remove goodbye message | ||
~ | ||
``` | ||
|
||
In this instance, `trunk` did move to the new commit: we asked `jj` to fetch | ||
information from our origin, and so it's adjusted things to match. However, `@` | ||
is still at our current commit. | ||
is still at our current commit (ie. the empty commit created by `jj git push`). | ||
|
||
Let's fix that: | ||
|
||
|
@@ -130,9 +137,9 @@ $ jj describe -m "add a comment to main" | |
Working copy now at: vmunwxsk 9410db49 add a comment to main | ||
Parent commit : ksrmwuon e202b67c trunk | Update Cargo.toml | ||
$ jj git push -c @ | ||
Creating branch push-vmunwxsksqvk for revision @ | ||
Branch changes to push to origin: | ||
Add branch push-vmunwxsksqvk to 9410db49f9ba | ||
Creating bookmark push-vmunwxsksqvk for revision vmunwxsksqvk | ||
Changes to push to origin: | ||
Add bookmark push-vmunwxsksqvk to 9410db49f9ba | ||
$ jj log | ||
@ vmunwxsk [email protected] 2024-03-02 08:27:30.000 -06:00 push-vmunwxsksqvk 9410db49 | ||
│ add a comment to main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters