@tzi; , . , , , , . ,
, (v. A), ( v. B). , , (v. B), () . , script , ( v. A WD v. B).
#!/bin/sh
...
git stash save -q --keep-index "current wd"
./your_script.sh
RESULT=$?
if [ $RESULT -ne 0 ]; then
git stash save -q "original index"
git stash apply -q --index stash@{1}
git stash drop -q; git stash drop -q
fi
[ $RESULT -ne 0 ] && exit 1
git add -u
git stash pop , , (v. A) (v. B) . , , script , git stash pop script (v. A ') (v. ). , script (v. A ') (v. B) (, , your_script.sh , , v. A v. A ' ).
: , , . , -, , ( ) , ( , )! .