Git Interactive Staging em shell script

Clone o script do github gist para o seu ambiente

Exemplo:

mkdir ~/bin/
cd
/bin
curl https
://gist.github.com/hvasconcelos/6081058/raw/d071cf06dddace0178d92f32af59b74038e4bff4/gitistage > gitistage
chmod u
+x gitistage
export PATH=$PATH:~/bin/

Código

#!/bin/bash
files
=`git status --porcelain | grep -e "^sM" | cut -d " " -f 3`
for file in $files; do
echo
"Differences in file"
git diff
--color=always $file
read
-p "Do you want to stage this file [y/n]" to_stage
if [ "$to_stage" == "y" -o "$to_stage" == "Y" ]; then
echo
"Staging file -> $file"
git
add $file
fi
done