Created
April 22, 2016 12:31
-
-
Save m3dwards/09f6a4ed8d345012ba2b2af7c9a60955 to your computer and use it in GitHub Desktop.
Better git add
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
function ga { | |
{ git ls-files -o --exclude-standard --full-name | while read -r file; do | |
read -u 3 -n 1 -p "Do you wish to add new file \"$file\"? (y/n) " answer | |
if echo "$answer" | grep -iq "^y" ;then | |
git add $file | |
echo $'\nAdded file\n' | |
else | |
echo $'\nSkipping file\n' | |
fi | |
done; } 3<&0 | |
git add -p | |
} | |
ga |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will first ask you if you wish to add each new untracked file and then will start the normal "patched" mode of git adding each hunk.
Should make it easy to do sanity check before adding items.
Just lift function definition into .bashrc.