Add .local/bin/git-restage

This commit is contained in:
Florian Beisel 2024-10-30 11:58:02 +01:00
parent d6338a24c1
commit 6aa1403f0b
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#!/bin/sh
# Stage all diffs found in currently staged files
# This is useful if you've got a set of files ready to commit, but edited one
# or more of them (via prettier, delinting, deleting debug statements, adding
# more tests, ...), and want to make sure those changes are included.
# Usage: `git restage`
# Installation: add this script to your $PATH and chmod +x.
# Hop down to the root of the repository so paths are correct:
cd "$(git rev-parse --show-toplevel)" || exit 1
# For all currently staged files, call `git stage`:
git diff --name-only --cached | xargs --verbose -n 1 -- git stage