Skip to content

Recognize amend aliases on macOS - #904

Merged
sds merged 2 commits into
sds:mainfrom
apiology:match-amend-aliases-on-macos-upstream
Oct 31, 2026
Merged

sds merged 2 commits 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
@sds
sds merged commit eccb68a into sds:main Oct 31, 2026
19 checks passed
@sds

sds commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants