Last active
August 29, 2015 13:56
-
-
Save spalger/9331512 to your computer and use it in GitHub Desktop.
Re-stages a staged file (courtesy of @esvinson)
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
gitFiles=$(git status --porcelain | grep "^[ADM\?][AMD] " | sed -e "s|^[ADM\?][AMD] ||") | |
if [[ -n "${gitFiles}" ]] ; then | |
for fname in $gitFiles ; do | |
git add --all -- "${fname}" | |
echo "Restaging ${fname}" | |
done | |
else | |
echo "No files changed" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Personally I use:
Just a little bit shorter :)
Thanks for the code though!