mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-26 06:40:38 +08:00
As a delegate, you shouldn't be able to delete your default branch. This would most likely happen by mistake, and it prevents the canonical head from being calculated correctly.
72 lines
2.0 KiB
Markdown
72 lines
2.0 KiB
Markdown
```
|
|
$ git checkout -b alice/1
|
|
$ git commit -m "Alice's commit" --allow-empty -s
|
|
[alice/1 87fa120] Alice's commit
|
|
```
|
|
|
|
``` (stderr) RAD_SOCKET=/dev/null
|
|
$ git push rad HEAD:alice/1
|
|
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
|
* [new branch] HEAD -> alice/1
|
|
```
|
|
|
|
Make sure we can't force-push without `+`:
|
|
|
|
``` (stderr)
|
|
$ git commit --amend -m "Alice's amended commit" --allow-empty -s
|
|
```
|
|
``` (stderr) (fail)
|
|
$ git push rad HEAD:alice/1
|
|
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
|
! [rejected] HEAD -> alice/1 (non-fast-forward)
|
|
error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi'
|
|
hint: [..]
|
|
hint: [..]
|
|
hint: [..]
|
|
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
|
|
```
|
|
|
|
And that we can with `+`:
|
|
|
|
``` (stderr)
|
|
$ git push -o no-sync rad +HEAD:alice/1
|
|
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
|
+ 87fa120...145e1e6 HEAD -> alice/1 (forced update)
|
|
```
|
|
|
|
Notice that we used the `-o no-sync` push option to disable syncing after the push.
|
|
|
|
```
|
|
$ git branch -r -vv
|
|
rad/alice/1 145e1e6 Alice's amended commit
|
|
rad/master f2de534 Second commit
|
|
```
|
|
|
|
List our namespaced refs:
|
|
|
|
```
|
|
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 'refs/heads/*'
|
|
145e1e69bef3ad93d14946ea212249c2fa9b9828 refs/heads/alice/1
|
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
|
```
|
|
|
|
List the canonical refs:
|
|
|
|
```
|
|
$ git ls-remote rad
|
|
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
|
```
|
|
|
|
```
|
|
$ rad sync --announce
|
|
✓ Synced with 1 node(s)
|
|
```
|
|
|
|
Note that it is forbidden to delete the default/canonical branch:
|
|
|
|
``` (fail) (stderr)
|
|
$ git push rad :master
|
|
error: refusing to delete default branch ref 'refs/heads/master'
|
|
error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi'
|
|
```
|