This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Stages modified hunks matching passed in regex | |
SEARCH=$1 | |
PATHS_DIVIDER=$2 | |
PATHS=$3 | |
if [ -z "$PATHS" ] | |
then | |
git diff -U1 | grepdiff "$SEARCH" --output-matching=hunk | git apply --cached | |
else | |
if [ "--" = "$PATHS_DIVIDER" ] | |
then | |
git diff -U1 -- $PATHS | grepdiff "$SEARCH" --output-matching=hunk | git apply --cached | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Stages modified hunks matching passed in regex | |
SEARCH=$1 | |
PATHS_DIVIDER=$2 | |
PATHS=$3 | |
if [ -z "$PATHS" ] | |
then | |
git diff -U1 | grepdiff "$SEARCH" --output-matching=hunk | git apply --cached | |
else | |
if [ "--" = "$PATHS_DIVIDER" ] | |
then | |
git diff -U1 -- $PATHS | grepdiff "$SEARCH" --output-matching=hunk | git apply --cached | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment