Skip to content

fix(tooling): push Git LFS objects from the shared pre-push hook - #61

Merged
WillieCubed merged 2 commits into
mainfrom
fix/pre-push-lfs
Sep 28, 2026
Merged

WillieCubed merged 2 commits into
mainfrom
fix/pre-push-lfs

Conversation

@WillieCubed

Copy link
Copy Markdown
Contributor

TL;DR

A repository that stores files with Git LFS can use the standard's pre-push hook unchanged: the
shared hook now uploads LFS objects with the push, after pnpm check passes. Fixes #58.

Overview of Changes

Why

The website stores images with Git LFS. Our hooks replace the one git lfs install writes, so the
website kept its own git lfs pre-push step below the shared line in .githooks/pre-push. That
makes its copy of a standard-owned file differ, and v0.5.0 already warns about it. v0.6.0 plans to
restore owned files to the standard's copies, which would have silently dropped the LFS step and
let pushes go out without their objects.

How

Git passes the refs being pushed on standard input. The shared hook now keeps them, runs pnpm check as before, and then, if git-lfs is installed and .gitattributes has a filter=lfs
rule, pipes them to git lfs pre-push with the hook's arguments. A repository without LFS sees no
difference.

A question for v0.6.0

The example's hook stubs say repository-specific steps go below the shared line, which conflicts
with treating the hooks as owned files. LFS was the only such step in use. Before v0.6.0 enforces
hook ownership, the stubs' wording has to change or the hooks come off the owned list; I noted this
on #58.

Testing

pnpm check passes. A new hook test runs the shared hook in a scratch repository with a fake
pnpm and git-lfs. It shows that nothing is uploaded without an LFS rule. With a rule, the check
runs first and git lfs pre-push receives the remote, the URL, and the refs from standard input.
ShellCheck passes on the hook.

Follow-ups

  • Once the website is on 0.5.3, remove its local LFS step so its hook matches the standard's.

🤖 Generated with Claude Code

WillieCubed and others added 2 commits September 28, 2026 12:05
A repository that stores files with Git LFS had to add git lfs pre-push
to its own .githooks/pre-push, because the shared hook replaced the one
git lfs install writes. The website did, so its stub differs from the
standard's and would lose the step if owned hooks were ever restored.

The shared hook now keeps the refs Git passes on standard input and,
after pnpm check passes, runs git lfs pre-push with them when git-lfs is
installed and .gitattributes has a filter=lfs rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Publish Git LFS support in the shared pre-push hook
as a patch release of the shared web standard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WillieCubed
WillieCubed merged commit f9f1bdf into main Sep 28, 2026
1 check passed
@WillieCubed
WillieCubed deleted the fix/pre-push-lfs branch September 28, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Push Git LFS objects from the shared pre-push hook

1 participant