Created
November 6, 2013 13:03
-
-
Save Maki-Daisuke/7335735 to your computer and use it in GitHub Desktop.
コメントのとおりですが、コミット用にステージされていないファイルの変更や、Gitの管理下におかれていないファイルがあると、コミットを拒否する pre-commit スクリプトです。
ちょっと厳しすぎる気もしますが……
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
#!/bin/sh | |
# | |
# A simple script to reject commit when there is an unstaged changes | |
# or an untracked file. | |
# | |
# To enable this script, copy this into .git/hooks in your working dir. | |
if `git status |grep -q 'Changes not staged for commit:'` | |
then | |
echo '[!!ERROR!!] Threre is a modified but unstaged file!' | |
exit 1; | |
fi | |
if `git status |grep -q 'Untracked files:'` | |
then | |
echo '[!!ERROR!!] There is an untracked file!' | |
exit 1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment