Commit graph dotfiles/bin
Author SHA1 Message Date
Jonny Barnes
24cb4c110a
git-sync: also mirror every branch the fork shares with upstream
The fork's copies of long-lived branches (demo-20, totara-19, lms) drifted
over a thousand commits behind upstream because only the default branch was
ever synced. Fast-forward each branch present on both remotes straight from
upstream's ref and push them in one go; skip and warn on divergence, and leave
a local copy alone if it carries commits of its own.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 09:16:21 +01:00
Jonny Barnes
80683b82c1
Add git sync, and stop trusting the cached default branch
BuildEmpire/Totara renamed its default branch from main to totara-20.
Nothing local noticed, because refs/remotes/origin/HEAD is written once at
clone time and remote.<name>.followRemoteHEAD defaults to `create`, which
only fills the ref in when it is missing. So `git default-branch` still
said main, as did nvim's diff-against-branch prompt.

bin/git-sync does the start-of-work sequence for a fork - fast-forward the
default branch from upstream, push it to origin - and works out which
branch that is by asking the server, not the cache. It sets the cached
HEADs from the answer, so everything reading that ref agrees afterwards.
It lives in bin/ rather than as an alias because git picks up git-<name>
on the $PATH as a subcommand, and this is more shell than a gitconfig
alias should hold. followRemoteHEAD = always is set for origin as well, so
an ordinary fetch keeps the ref current without running the script.

The nvim prompt now prefers origin, then upstream, then the remaining
remotes. It took the first remote alphabetically before, which in
be-edition means kdog - a colleague's fork - rather than anything
authoritative.

Verified against a fixture of bare repos whose default branch is
totara-20 and whose cached HEAD is stale: the branch is created tracking
origin when absent, fast-forwarded when behind, pushed to the fork,
refuses to merge when the local copy has diverged, and is a no-op on a
second run. The nvim prompt was checked in three real repos.
2026-08-27 16:05:49 +01:00
2f3e3393d8
Update cp-torrent command 2026-04-12 11:24:18 +01:00
761378d9b8
Add a script to copy torrent files 2025-03-16 16:13:47 +00:00