PHPackages                             phputil/restage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phputil/restage

ActiveApplication[Utility &amp; Helpers](/categories/utility)

phputil/restage
===============

Add only modified files to the staging area

v0.4.1(1y ago)11155MITPHPPHP &gt;=7.0

Since Oct 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/thiagodp/restage)[ Packagist](https://packagist.org/packages/phputil/restage)[ RSS](/packages/phputil-restage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (5)

restage
=======

[](#restage)

> ✅ Add only modified files to the staging area

**Use case**: You're using Git and your files are ready to commit. But when you run `git commit`, your `pre-commit` Git Hook runs a formatting tool that changes your files again. Now you have to run `git add` again, but only for the changed files, since you don't want to add untracked files yet. *That's boring, I know*. Fortunately, now you can use `restage` for that.

👉 `restage` adds only modified files to the staging area.

*Note*: There are similar tools for JavaScript, such as [lint-staged](https://github.com/lint-staged/lint-staged), that can be used for this purpose. `restage` aims at projects that do not need to use JavaScript.

Install
-------

[](#install)

> Requires only PHP 7.0+ and Git

```
composer require phputil/restage --dev
```

Usage
-----

[](#usage)

```
php vendor/bin/restage
```

You probably want to include the above command into your Git Hook (e.g. `pre-commit`), to be executed after a command that formats your source code. For instance, `php vendor/bin/php-cs-fixer && php vendor/bin/restage`.

### CLI Options

[](#cli-options)

```
  --help          This help.
  --all,      -a  List untracked files and modified staged files.
  --dry-run,  -d  Simulate the command without actually doing anything.
  --modified, -m  List modified staged files.
  --verbose,  -v  Enable verbose mode.
```

👉 If you wanna run a linter/formatter in modified files, you can use `--modified` to get them.

### Useful tools

[](#useful-tools)

- [Captain Hook](https://github.com/captainhookphp/captainhook) can manage your Git Hooks.
- [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) can format your source code.
- [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) is an alternative to PHP-CS-Fixer.

License
-------

[](#license)

[MIT](LICENSE) © [Thiago Delgado Pinto](https://github.com/thiagodp)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~47 days

Recently: every ~59 days

Total

6

Last Release

709d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/154324d722a6ee9c252a0338329781084a97af2d0ea9faaf39176df5a689a2ec?d=identicon)[thiagodp](/maintainers/thiagodp)

---

Top Contributors

[![thiagodp](https://avatars.githubusercontent.com/u/2997844?v=4)](https://github.com/thiagodp "thiagodp (14 commits)")

---

Tags

areacaptain-hookgithuskyhusky-phplintlint-stagedphpstagestagedstaging-area

### Embed Badge

![Health badge](/badges/phputil-restage/health.svg)

```
[![Health](https://phpackages.com/badges/phputil-restage/health.svg)](https://phpackages.com/packages/phputil-restage)
```

###  Alternatives

[kodicms/module-loader

1614.9k11](/packages/kodicms-module-loader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
