Commit graph dotfiles/gitconfig
Author SHA1 Message Date
Jonny Barnes
3b4b84fb20
Note that followRemoteHEAD invents a URL-less origin
Git materialises a remote from the existence of any remote.<name>.* key,
so remote.origin.followRemoteHEAD makes `git remote` list an origin in
every repo without one - this dotfiles repo included. It reads as a
broken remote to anyone looking, and has now been misdiagnosed as
leftover cruft twice. Nothing is actually wrong: get-url still fails, so
the guards in git-sync and nvim's default_branch() hold. Say so in both
places someone would look.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 21:45:12 +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
Jonny Barnes
583bbaa533
Move git identity to an included ~/.gitconfig.local
~/.extra ran five `git config --global` writes on every shell startup, to
re-assert identity and signing after bootstrap.sh copies gitconfig over
~/.gitconfig. The dark-mode-notify agent fires on wake/unlock and runs
`pkill -usr1 zsh`, so every shell re-sources .zshrc — and therefore .extra —
simultaneously. `git config` locks with O_EXCL and has no retry or timeout for
config files, so the concurrent writes raced and printed:

    error: could not lock config file /Users/jonny/.gitconfig: File exists

Identity and signing now live in an untracked ~/.gitconfig.local, included
last from gitconfig so it wins over anything above. bootstrap.sh seeds it from
gitconfig.local.template only when absent, so re-runs never clobber the real
signing key. No git writes happen on shell startup at all now.

Verified: fully-resolved config is unchanged apart from the new include.path;
author and committer both resolve from config with no GIT_* env vars set;
existing commits still verify. 12 concurrent sources of .extra are silent,
where the old version produced 27 lock errors.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 09:57:19 +01:00
6c23a03412
Improvements to lazygit/tmux/ghossty configs 2026-01-30 14:42:51 +00:00
0463ec34bf
Update git config
Additional config based on https://blog.gitbutler.com/how-git-core-devs-configure-git/
2025-02-27 17:44:37 +00:00
45f8717558
Fix issue with delta diff viewer in forgit 2024-11-21 19:55:56 +00:00
12dd8faba4
Update gitconfig with better settings, especially for delta 2024-02-17 14:54:15 +00:00
4dde4482b0
Add default-branch alias to git 2023-10-21 10:37:47 +01:00
92af579f43 Setup allowed signers file for commit/tag verification 2022-06-06 17:30:48 +01:00
716b2b7b49 Remove commented out git config directives 2022-06-06 17:27:49 +01:00
d07707f992 Make the default git branch be called main 2022-03-19 10:14:25 +00:00
873be7be01 Improve diffs by using the git-delta package
Also, switch the diffing to using `zdiff3` and the `histogram` algorithm
2022-02-27 09:08:17 +00:00
a77fa59131 Set signing program to ssh 2021-11-15 20:01:25 +00:00
f8a8453a9a Prompt for corrections to typos 2021-11-15 19:52:17 +00:00
b791dfacf3 Add some more aliases 2017-03-08 13:27:03 +00:00
297ac5e14c Add an alias to show all aliases 2017-03-07 23:15:25 +00:00
8dc80cf500 Use diff-so-fancy 2016-05-12 17:46:07 +01:00
9e40d54a7b Initial global git settings 2016-04-07 22:00:24 +01:00