A pre-commit hook like this should alarm about leftover files:
#!/bin/bash
. git-sh-setup # for 'die' cmd
git status --porcelain | while IFS= read -r line;
do
if [[ $line == \?\?* ]] ; then # if the file begins with ?? it's untracked by git
die "Uncommited files left!" # this will always terminate commit
# say "Uncommited files left!" # this will just print the warning
fi
done
EDIT: you should also consider using some continuous integration toolkit like Hudson or Buildbot - it can perform a lot more comprehensive check then looking for missing files :)
EDIT2: unfortunately I didn't succeed in using read inside the loop so I think it might not be possible to make this hook ask for your action.
A pre-commit hook like this should alarm about leftover files:
Just add this to your repo's pre-commit hooks and voile :)
EDIT: you should also consider using some continuous integration toolkit like Hudson or Buildbot - it can perform a lot more comprehensive check then looking for missing files :)
EDIT2: unfortunately I didn't succeed in using read inside the loop so I think it might not be possible to make this hook ask for your action.