Skip to content

Recognize amend aliases on macOS - #904

Open
apiology wants to merge 1 commit into
sds:mainfrom
apiology:match-amend-aliases-on-macos-upstream
Open

apiology wants to merge 1 commit into
sds:mainfrom
apiology:match-amend-aliases-on-macos-upstream

Conversation

@apiology

Copy link
Copy Markdown
Contributor

Claude: This PR was written by Claude Code on behalf of @apiology.

Problem

On macOS, amending through a git alias isn't recognized as an amend:

$ git config alias.amend "commit --amend"
# no output, exit 1: macOS git does not understand \s
$ git config --get-regexp '^alias\.' 'commit(\s.*)?\s--amend(\s|$)'

Hooks that treat amends specially (e.g. including the previous commit's changes) misbehave for macOS users who amend via an alias, and the four #amendment? alias specs fail there.

Solution

Spell the pattern with the POSIX [[:space:]] class, which macOS git, Linux git and Ruby's regex engine all understand.

macOS git's regex library does not support `\s`, so
`git config --get-regexp` never matched an alias for `commit --amend`
and amendment? returned false. Use the POSIX `[[:space:]]` class,
which both git and Ruby understand.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wo4FerFK9aaxrGrmVE9ncZ
@apiology
apiology marked this pull request as ready for review October 21, 2026 20:57

This branch has not been deployed

No deployments
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.

1 participant