/ radicle-cli / examples / rad-patch-draft.md
rad-patch-draft.md
 1  Let's say we have some changes in a branch:
 2  
 3  ```
 4  $ git checkout -b cloudhead/draft
 5  $ git commit -a -m "Nothing to see here.." -q --allow-empty
 6  ```
 7  
 8  To open a patch in draft mode, we use the `--draft` option:
 9  
10  ``` (stderr)
11  $ git push -o patch.draft -o patch.message="Nothing yet" rad HEAD:refs/patches
12  ✓ Patch 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc drafted
13  To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
14   * [new reference]   HEAD -> refs/patches
15  ```
16  
17  We can confirm it's a draft by running `show`:
18  
19  ```
20  $ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
21  ╭────────────────────────────────────────────────────╮
22  │ Title     Nothing yet                              │
23  │ Patch     78fcb007b4a3a898379f1e220d4b9fb54ad04cfc │
24  │ Author    z6MknSL…StBU8Vi (you)                    │
25  │ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
26  │ Branches  cloudhead/draft                          │
27  │ Commits   ahead 1, behind 0                        │
28  │ Status    draft                                    │
29  ├────────────────────────────────────────────────────┤
30  │ 2a46583 Nothing to see here..                      │
31  ├────────────────────────────────────────────────────┤
32  │ ● opened by z6MknSL…StBU8Vi (you) [   ...    ]     │
33  ╰────────────────────────────────────────────────────╯
34  ```
35  
36  Once the patch is ready for review, we can use the `ready` command:
37  
38  ```
39  $ rad patch ready 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
40  ```
41  
42  ```
43  $ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
44  ╭────────────────────────────────────────────────────╮
45  │ Title     Nothing yet                              │
46  │ Patch     78fcb007b4a3a898379f1e220d4b9fb54ad04cfc │
47  │ Author    z6MknSL…StBU8Vi (you)                    │
48  │ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
49  │ Branches  cloudhead/draft                          │
50  │ Commits   ahead 1, behind 0                        │
51  │ Status    open                                     │
52  ├────────────────────────────────────────────────────┤
53  │ 2a46583 Nothing to see here..                      │
54  ├────────────────────────────────────────────────────┤
55  │ ● opened by z6MknSL…StBU8Vi (you) [   ...    ]     │
56  ╰────────────────────────────────────────────────────╯
57  ```
58  
59  If for whatever reason, it needed to go back into draft mode, we could use
60  the `--undo` flag:
61  
62  ```
63  $ rad patch ready --undo 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
64  $ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
65  ╭────────────────────────────────────────────────────╮
66  │ Title     Nothing yet                              │
67  │ Patch     78fcb007b4a3a898379f1e220d4b9fb54ad04cfc │
68  │ Author    z6MknSL…StBU8Vi (you)                    │
69  │ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
70  │ Branches  cloudhead/draft                          │
71  │ Commits   ahead 1, behind 0                        │
72  │ Status    draft                                    │
73  ├────────────────────────────────────────────────────┤
74  │ 2a46583 Nothing to see here..                      │
75  ├────────────────────────────────────────────────────┤
76  │ ● opened by z6MknSL…StBU8Vi (you) [   ...    ]     │
77  ╰────────────────────────────────────────────────────╯