/ radicle-cli / examples / rad-patch-update.md
rad-patch-update.md
 1  Let's explore the `rad patch update` plumbing command. First we create a patch:
 2  
 3  ``` (stderr)
 4  $ git checkout -q -b feature/1
 5  $ git commit -q -m "Not a real change" --allow-empty
 6  ```
 7  ``` (stderr)
 8  $ git push rad HEAD:refs/patches
 9  ✓ Patch 2541d346ba0b9377b3d38852dfded43f23833fc1 opened
10  To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
11   * [new reference]   HEAD -> refs/patches
12  ```
13  
14  ```
15  $ rad patch show 2541d346ba0b9377b3d38852dfded43f23833fc1
16  ╭────────────────────────────────────────────────────╮
17  │ Title     Not a real change                        │
18  │ Patch     2541d346ba0b9377b3d38852dfded43f23833fc1 │
19  │ Author    z6MknSL…StBU8Vi (you)                    │
20  │ Head      51b2f0f77b9849bfaa3e9d3ff68ee2f57771d20c │
21  │ Branches  feature/1                                │
22  │ Commits   ahead 1, behind 0                        │
23  │ Status    open                                     │
24  ├────────────────────────────────────────────────────┤
25  │ 51b2f0f Not a real change                          │
26  ├────────────────────────────────────────────────────┤
27  │ ● opened by z6MknSL…StBU8Vi (you) now              │
28  ╰────────────────────────────────────────────────────╯
29  ```
30  
31  We can make some changes to the repository:
32  
33  ```
34  $ git mv README README.md
35  $ git commit -q -m "Rename readme file"
36  ```
37  
38  Let's push the changes, but not to the magic ref, that way the push doesn't
39  update our patch:
40  
41  ```
42  $ git push rad HEAD:refs/heads/feature/1
43  ```
44  
45  Now, instead of using `git push` to update the patch, as we normally would,
46  we run:
47  
48  ```
49  $ rad patch update 2541d346ba0b9377b3d38852dfded43f23833fc1 -m "Updated patch"
50  d9c9ef902f2957d746bb53e744e69a5c3aa564bc
51  ```
52  
53  The command outputs the new Revision ID, which we can now see here:
54  
55  ```
56  $ rad patch show 2541d346ba0b9377b3d38852dfded43f23833fc1
57  ╭─────────────────────────────────────────────────────────────────────╮
58  │ Title     Not a real change                                         │
59  │ Patch     2541d346ba0b9377b3d38852dfded43f23833fc1                  │
60  │ Author    z6MknSL…StBU8Vi (you)                                     │
61  │ Head      4d272148458a17620541555b1f0905c01658aa9f                  │
62  │ Branches  feature/1                                                 │
63  │ Commits   ahead 2, behind 0                                         │
64  │ Status    open                                                      │
65  ├─────────────────────────────────────────────────────────────────────┤
66  │ 4d27214 Rename readme file                                          │
67  │ 51b2f0f Not a real change                                           │
68  ├─────────────────────────────────────────────────────────────────────┤
69  │ ● opened by z6MknSL…StBU8Vi (you) now                               │
70  │ ↑ updated to d9c9ef902f2957d746bb53e744e69a5c3aa564bc (4d27214) now │
71  ╰─────────────────────────────────────────────────────────────────────╯
72  ```