Confirm git commit -am
before you accidentally commit everything.
Note: git-hooks would have been an option if they were system-wide.
- Store
git-check-add.py
somewhere - Add the contents of
.profile
to your.profile
. Adapt path togit-check-add.py
Tested with zsh
only.
Example session where it prevents you from accidentally committing all files.
> git add file*.txt
> git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: fileA.txt
modified: fileB.txt
modified: fileC.txt
modified: fileD.txt
modified: fileE.txt
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: IDontWantThisFileYetA.txt
modified: IDontWantThisFileYetB.txt
modified: IDontWantThisFileYetC.txt
> git commit -am "Added files A-E"
Confirm add-then-commit [Yn]: n
> git commit -m "Added files A-E"
[master] Added files A-E
5 files changed, 100 insertion(+), 0 deletions(-)