# 使用 Homebrew 安装 git-format-staged

查看 git-format-staged 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:git-format-staged
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install git-format-staged
```

  证据: local Homebrew formula metadata

## 软件包事实

- **软件包键:** brew:git-format-staged
- **软件包管理器:** Homebrew
- **版本:** 4.0.2
- **来源摘要:** Git command to transform staged files using a formatting command
- **主页:** <https://github.com/hallettj/git-format-staged>
- **仓库:** <https://github.com/hallettj/git-format-staged>
- **最后更新:** 2026-08-03T14:53:25Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- git-format-staged (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 4.0.2
## 项目历史与用法

git-format-staged is a Python Git helper that runs a formatter or linter against the staged version of files, preserving unstaged working-tree edits.

### 项目历史

The repository began in March 2018. Its README explains the project as a response to pre-commit formatting hooks that run a formatter over working-tree files and then restage the result, a pattern that can accidentally commit unrelated unstaged edits or disrupt `git add -p` workflows.

### 采用历史

git-format-staged sits in the ecosystem around Prettier, Husky, lint-staged, pre-commit, pretty-quick, and language-specific hook managers. It distinguishes itself by formatting blobs from the Git index and then attempting to patch the working tree afterward, rather than stashing user edits before formatting.

### 使用方式

Practitioners install it through Nix, npm, Homebrew, or by copying the script, then call it from pre-commit hooks with a formatter command that reads from stdin and writes to stdout. Typical use passes file patterns and a formatter placeholder, such as running Prettier with `--stdin-filepath` for staged JavaScript, TypeScript, or CSS files.

### 为什么软件包爱好者会关心

The package is notable because it solves a small but sharp Git-index problem without tying users to one language ecosystem. That makes it attractive for polyglot repositories and hook setups where the important boundary is Git's staged content rather than a particular formatter.

### 时间线

- 2018: The repository began with an initial commit.
- 2018: The v1.0.0 tag established the installable Git helper.
- Later releases: Packaging expanded across npm, Nix, and Homebrew usage paths.

### Related projects

- git-format-staged is commonly compared with lint-staged, pre-commit, pretty-quick, precise-commits, Husky, and formatter tools such as Prettier.

### 来源

- <https://formulae.brew.sh/formula/git-format-staged>
- <https://github.com/hallettj/git-format-staged>
- <https://github.com/hallettj/git-format-staged#readme>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## Combined YAML source

View the package source record on GitHub. [combined/git-format-staged.yml](https://github.com/mxcl/pkgdb/blob/main/combined/git-format-staged.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- cross-ecosystem install command graph
