radicle-heartwood-lfs/radicle-cli/examples/rad-merge-via-push.md

120 lines
5.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Let's start by creating two patches.
``` (stderr) RAD_SOCKET=/dev/null
$ git checkout -b feature/1 -q
$ git commit --allow-empty -q -m "First change"
$ git push rad HEAD:refs/patches
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
``` (stderr) RAD_SOCKET=/dev/null
$ git checkout -b feature/2 -q master
$ git commit --allow-empty -q -m "Second change"
$ git push rad HEAD:refs/patches
✓ Patch 8357a9f1d61e80309d314491aa754969d9f47d77 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
This creates some remote tracking branches for us:
```
$ git branch -r
rad/master
rad/patches/8357a9f1d61e80309d314491aa754969d9f47d77
rad/patches/a1207f6e82700e42cc46c9c38c7786b18cbd2040
```
And some remote refs:
```
$ rad inspect --refs
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
└── refs
   ├── cobs
   │   ├── xyz.radicle.id
   │   │   └── 0656c217f917c3e06234771e9ecae53aba5e173e
   │   └── xyz.radicle.patch
   │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77
   │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040
   ├── heads
   │   ├── master
   │   └── patches
   │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77
   │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040
   └── rad
      ├── id
      └── sigrefs
```
Then let's merge the changes into `master`.
``` (stderr) RAD_SOCKET=/dev/null
$ git checkout master
Switched to branch 'master'
$ git merge feature/1
$ git merge feature/2
```
When we push to `rad/master`, we automatically merge the patches:
``` (stderr) RAD_SOCKET=/dev/null
$ git push rad master
✓ Patch 8357a9f1d61e80309d314491aa754969d9f47d77 merged
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged
✓ Canonical head updated to d6399c71702b40bae00825b3c444478d06b4e91c
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..d6399c7 master -> master
```
```
$ rad patch --merged
╭────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │
├────────────────────────────────────────────────────────────────────┤
│ ✔ [ ... ] Second change alice (you) daf349f +0 -0 now │
│ ✔ [ ... ] First change alice (you) 20aa5dd +0 -0 now │
╰────────────────────────────────────────────────────────────────────╯
$ rad patch show 8357a9f1d61e80309d314491aa754969d9f47d77
╭────────────────────────────────────────────────────────────────╮
│ Title Second change │
│ Patch 8357a9f1d61e80309d314491aa754969d9f47d77 │
│ Author alice (you) │
│ Head daf349ff76bedf48c5f292290b682ee7be0683cf │
│ Branches feature/2 │
│ Commits ahead 0, behind 2 │
│ Status merged │
├────────────────────────────────────────────────────────────────┤
│ daf349f Second change │
├────────────────────────────────────────────────────────────────┤
│ ● opened by alice (you) now │
│ └─ ✓ merged by alice (you) at revision 8357a9f (d6399c7) now │
╰────────────────────────────────────────────────────────────────╯
```
We can verify that the remote tracking branches were also deleted:
```
$ git branch -r
rad/master
```
And so were the remote branches:
```
$ rad inspect --refs
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
└── refs
   ├── cobs
   │   ├── xyz.radicle.id
   │   │   └── 0656c217f917c3e06234771e9ecae53aba5e173e
   │   └── xyz.radicle.patch
   │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77
   │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040
   ├── heads
   │   └── master
   └── rad
      ├── id
      └── sigrefs
```