Coder Social home page Coder Social logo

restage's Introduction

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, that can be used for this purpose. restage aims at projects that do not need to use JavaScript.

Install

Requires only PHP 7.0+ and Git

composer require phputil/restage --dev

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

  --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

License

MIT © Thiago Delgado Pinto

restage's People

Contributors

thiagodp avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.