radicle-heartwood-lfs/radicle-cli/examples/rad-merge-after-update.md

1.3 KiB

Let's start by creating a patch.

$ 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

Then let's update the code and merge the updated code without updating the patch:

$ git commit --amend --allow-empty -q -m "Amended change"
$ git checkout master -q
$ git merge feature/1 -q
$ git push rad master
✓ Canonical head updated to 954bcdb5008447ce294a61a21d7eb87afbe7f4a6
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
   f2de534..954bcdb  master -> master

As we can see, no patch is merged. Now if we go back to our patch and try to update it, we expect it to be updated and merged:

$ git checkout feature/1 -q
$ git push -f
✓ Patch a1207f6 updated to [...]
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 + 20aa5dd...954bcdb feature/1 -> patches/a1207f6e82700e42cc46c9c38c7786b18cbd2040 (forced update)