Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
.. framework git workflow jj-config.md jj-init-bare.md jj-init-colocate.md rad-auth-errors.md rad-auth.md rad-block.md rad-checkout-repo-config-linux.md rad-checkout-repo-config-macos.md rad-checkout.md rad-clean.md rad-clone-all.md rad-clone-bare.md rad-clone-connect.md rad-clone-directory.md rad-clone-partial-fail.md rad-clone-scope.md rad-clone-unknown.md rad-clone.md rad-cob-log.md rad-cob-migrate.md rad-cob-multiset rad-cob-multiset.md rad-cob-operations.md rad-cob-show.md rad-cob-update-identity.md rad-cob-update.md rad-config.md rad-diff.md rad-fetch.md rad-fork.md rad-help.md rad-id-collaboration.md rad-id-conflict.md rad-id-multi-delegate.md rad-id-private.md rad-id-threshold-soft-fork.md rad-id-threshold.md rad-id-unauthorized-delegate.md rad-id-unknown-field.md rad-id-update-delete-field.md rad-id.md rad-inbox.md rad-init-detached-head.md rad-init-existing-bare.md rad-init-existing.md rad-init-no-git.md rad-init-no-seed.md rad-init-private-clone-seed.md rad-init-private-clone.md rad-init-private-no-seed.md rad-init-private-seed.md rad-init-private.md rad-init-sync-not-connected.md rad-init-sync-preferred.md rad-init-sync-timeout.md rad-init-sync.md rad-init-with-existing-remote.md rad-init.md rad-inspect-noauth.md rad-inspect.md rad-issue-list.md rad-issue.md rad-key-mismatch.md rad-merge-after-update.md rad-merge-no-ff.md rad-merge-via-push.md rad-node.md rad-patch-ahead-behind.md rad-patch-change-base.md rad-patch-checkout-force.md rad-patch-checkout-revision.md rad-patch-checkout.md rad-patch-delete.md rad-patch-detached-head.md rad-patch-diff.md rad-patch-draft.md rad-patch-edit.md rad-patch-fetch-1.md rad-patch-fetch-2.md rad-patch-jj.md rad-patch-merge-draft.md rad-patch-open-explore.md rad-patch-pull-update.md rad-patch-revert-merge.md rad-patch-update.md rad-patch-via-push.md rad-patch.md rad-publish.md rad-push-and-pull-patches.md rad-remote.md rad-review-by-hunk.md rad-seed-and-follow.md rad-seed-many.md rad-seed-policy-allow-no-scope.md rad-seed-scope.md rad-self.md rad-sync-without-node.md rad-sync.md rad-unseed-many.md rad-unseed.md rad-warn-old-nodes.md rad-watch.md
heartwood crates radicle-cli examples rad-review-by-hunk.md

Let’s start by creating some files we will patch:

Classics
--------
Salmon Tartare
Mac & Cheese

Comfort Food
------------
Reuben Sandwich
Club Sandwich
Fried Shrimp Basket

Sides
-----
French Fries
Notes on how to prepare food go here.
*.draft

Now let’s commit and push them:

$ git add MENU.txt INSTRUCTIONS.txt .gitignore
$ git commit -q -a -m "Add files"
$ git push rad master

We can now make some changes and create a patch:

$ sed -i '$a Garlic Green Beans' MENU.txt
$ sed -i '3i\Baked Brie' MENU.txt
$ sed -i 's/French Fries/French Fries!/' MENU.txt
$ rm .gitignore
$ mkdir notes
$ mv INSTRUCTIONS.txt notes/
All food is served as-is, with no warranty!
$ git checkout -q -b patch/1
$ git add .
$ git status --short
D  .gitignore
A  DISCLAIMER.txt
M  MENU.txt
R  INSTRUCTIONS.txt -> notes/INSTRUCTIONS.txt
$ git commit -q -m "Update files"
$ git push rad HEAD:refs/patches
✓ Patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 * [new reference]   HEAD -> refs/patches

Finally, we do a review of the patch by hunk. The output of this command should match git diff master -W100% -U5 --patience:

$ rad patch review --patch -U5 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
╭──────────────────────╮
│ .gitignore ❲deleted❳ │
├──────────────────────┤
│ @@ -1,1 +0,0 @@      │
│ 1          - *.draft │
╰──────────────────────╯
╭──────────────────────────────────────────────────────────╮
│ DISCLAIMER.txt ❲created❳                                 │
├──────────────────────────────────────────────────────────┤
│ @@ -0,0 +1,1 @@                                          │
│      1     + All food is served as-is, with no warranty! │
╰──────────────────────────────────────────────────────────╯
╭─────────────────────────────╮
│ MENU.txt                    │
├─────────────────────────────┤
│ @@ -1,7 +1,8 @@             │
│ 1    1       Classics       │
│ 2    2       --------       │
│      3     + Baked Brie     │
│ 3    4       Salmon Tartare │
│ 4    5       Mac & Cheese   │
│ 5    6                      │
│ 6    7       Comfort Food   │
│ 7    8       ------------   │
╰─────────────────────────────╯
╭──────────────────────────────────╮
│ MENU.txt                         │
├──────────────────────────────────┤
│ @@ -9,6 +10,7 @@ Reuben Sandwich │
│ 9    10      Club Sandwich       │
│ 10   11      Fried Shrimp Basket │
│ 11   12                          │
│ 12   13      Sides               │
│ 13   14      -----               │
│ 14         - French Fries        │
│      15    + French Fries!       │
│      16    + Garlic Green Beans  │
╰──────────────────────────────────╯
╭────────────────────────────────────────────────────╮
│ INSTRUCTIONS.txt -> notes/INSTRUCTIONS.txt ❲moved❳ │
╰────────────────────────────────────────────────────╯

Now let’s accept these hunks one by one..

$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭──────────────────────╮
│ .gitignore ❲deleted❳ │
├──────────────────────┤
│ @@ -1,1 +0,0 @@      │
│ 1          - *.draft │
╰──────────────────────╯
✓ Updated brain to a5fccf0e977225ff13c3f74c43faf4cb679bf835
$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭──────────────────────────────────────────────────────────╮
│ DISCLAIMER.txt ❲created❳                                 │
├──────────────────────────────────────────────────────────┤
│ @@ -0,0 +1,1 @@                                          │
│      1     + All food is served as-is, with no warranty! │
╰──────────────────────────────────────────────────────────╯
✓ Updated brain to 2cdb82ea726e64d3b52847c7699d0d4759198f5c
$ rad patch review --patch --accept -U3 --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭─────────────────────────────╮
│ MENU.txt                    │
├─────────────────────────────┤
│ @@ -1,5 +1,6 @@             │
│ 1    1       Classics       │
│ 2    2       --------       │
│      3     + Baked Brie     │
│ 3    4       Salmon Tartare │
│ 4    5       Mac & Cheese   │
│ 5    6                      │
╰─────────────────────────────╯
✓ Updated brain to d4aecbb859a802a3215def0b538358bf63593953
$ rad patch review --patch --accept -U3 --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭───────────────────────────────────────╮
│ MENU.txt                              │
├───────────────────────────────────────┤
│ @@ -12,4 +12,5 @@ Fried Shrimp Basket │
│ 12   12                               │
│ 13   13      Sides                    │
│ 14   14      -----                    │
│ 15         - French Fries             │
│      15    + French Fries!            │
│      16    + Garlic Green Beans       │
╰───────────────────────────────────────╯
✓ Updated brain to 59cee720b0642b1491b241400912b35926a76c3f
$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭────────────────────────────────────────────────────╮
│ INSTRUCTIONS.txt -> notes/INSTRUCTIONS.txt ❲moved❳ │
╰────────────────────────────────────────────────────╯
✓ Updated brain to 3effc8f6462fa2573697072245e57708c4dcbe62
$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
✓ All hunks have been reviewed
Let's start by creating some files we will patch:

``` ./MENU.txt
Classics
--------
Salmon Tartare
Mac & Cheese

Comfort Food
------------
Reuben Sandwich
Club Sandwich
Fried Shrimp Basket

Sides
-----
French Fries
```

``` ./INSTRUCTIONS.txt
Notes on how to prepare food go here.
```

``` ./.gitignore
*.draft
```

Now let's commit and push them:

```
$ git add MENU.txt INSTRUCTIONS.txt .gitignore
$ git commit -q -a -m "Add files"
$ git push rad master
```

We can now make some changes and create a patch:

```
$ sed -i '$a Garlic Green Beans' MENU.txt
$ sed -i '3i\Baked Brie' MENU.txt
$ sed -i 's/French Fries/French Fries!/' MENU.txt
$ rm .gitignore
$ mkdir notes
$ mv INSTRUCTIONS.txt notes/
```

``` ./DISCLAIMER.txt
All food is served as-is, with no warranty!
```

```
$ git checkout -q -b patch/1
$ git add .
$ git status --short
D  .gitignore
A  DISCLAIMER.txt
M  MENU.txt
R  INSTRUCTIONS.txt -> notes/INSTRUCTIONS.txt
$ git commit -q -m "Update files"
```

``` (stderr)
$ git push rad HEAD:refs/patches
✓ Patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 * [new reference]   HEAD -> refs/patches
```

Finally, we do a review of the patch by hunk. The output of this command should
match `git diff master -W100% -U5 --patience`:

```
$ rad patch review --patch -U5 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
╭──────────────────────╮
│ .gitignore ❲deleted❳ │
├──────────────────────┤
│ @@ -1,1 +0,0 @@      │
│ 1          - *.draft │
╰──────────────────────╯
╭──────────────────────────────────────────────────────────╮
│ DISCLAIMER.txt ❲created❳                                 │
├──────────────────────────────────────────────────────────┤
│ @@ -0,0 +1,1 @@                                          │
│      1     + All food is served as-is, with no warranty! │
╰──────────────────────────────────────────────────────────╯
╭─────────────────────────────╮
│ MENU.txt                    │
├─────────────────────────────┤
│ @@ -1,7 +1,8 @@             │
│ 1    1       Classics       │
│ 2    2       --------       │
│      3     + Baked Brie     │
│ 3    4       Salmon Tartare │
│ 4    5       Mac & Cheese   │
│ 5    6                      │
│ 6    7       Comfort Food   │
│ 7    8       ------------   │
╰─────────────────────────────╯
╭──────────────────────────────────╮
│ MENU.txt                         │
├──────────────────────────────────┤
│ @@ -9,6 +10,7 @@ Reuben Sandwich │
│ 9    10      Club Sandwich       │
│ 10   11      Fried Shrimp Basket │
│ 11   12                          │
│ 12   13      Sides               │
│ 13   14      -----               │
│ 14         - French Fries        │
│      15    + French Fries!       │
│      16    + Garlic Green Beans  │
╰──────────────────────────────────╯
╭────────────────────────────────────────────────────╮
│ INSTRUCTIONS.txt -> notes/INSTRUCTIONS.txt ❲moved❳ │
╰────────────────────────────────────────────────────╯
```

Now let's accept these hunks one by one..

```
$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭──────────────────────╮
│ .gitignore ❲deleted❳ │
├──────────────────────┤
│ @@ -1,1 +0,0 @@      │
│ 1          - *.draft │
╰──────────────────────╯
✓ Updated brain to a5fccf0e977225ff13c3f74c43faf4cb679bf835
```
```
$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭──────────────────────────────────────────────────────────╮
│ DISCLAIMER.txt ❲created❳                                 │
├──────────────────────────────────────────────────────────┤
│ @@ -0,0 +1,1 @@                                          │
│      1     + All food is served as-is, with no warranty! │
╰──────────────────────────────────────────────────────────╯
✓ Updated brain to 2cdb82ea726e64d3b52847c7699d0d4759198f5c
```
```
$ rad patch review --patch --accept -U3 --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭─────────────────────────────╮
│ MENU.txt                    │
├─────────────────────────────┤
│ @@ -1,5 +1,6 @@             │
│ 1    1       Classics       │
│ 2    2       --------       │
│      3     + Baked Brie     │
│ 3    4       Salmon Tartare │
│ 4    5       Mac & Cheese   │
│ 5    6                      │
╰─────────────────────────────╯
✓ Updated brain to d4aecbb859a802a3215def0b538358bf63593953
```
```
$ rad patch review --patch --accept -U3 --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭───────────────────────────────────────╮
│ MENU.txt                              │
├───────────────────────────────────────┤
│ @@ -12,4 +12,5 @@ Fried Shrimp Basket │
│ 12   12                               │
│ 13   13      Sides                    │
│ 14   14      -----                    │
│ 15         - French Fries             │
│      15    + French Fries!            │
│      16    + Garlic Green Beans       │
╰───────────────────────────────────────╯
✓ Updated brain to 59cee720b0642b1491b241400912b35926a76c3f
```

```
$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
╭────────────────────────────────────────────────────╮
│ INSTRUCTIONS.txt -> notes/INSTRUCTIONS.txt ❲moved❳ │
╰────────────────────────────────────────────────────╯
✓ Updated brain to 3effc8f6462fa2573697072245e57708c4dcbe62
```

```
$ rad patch review --patch --accept --hunk 1 7a2ac7e2841cc1e7394f99f107555a499b1d3f23 --no-announce
✓ Loaded existing review ([..]) for patch 7a2ac7e2841cc1e7394f99f107555a499b1d3f23
✓ All hunks have been reviewed
```