diff options
author | 2014-06-25 10:35:08 +0000 | |
---|---|---|
committer | 2014-06-25 10:35:08 +0000 | |
commit | d116f6ce5e616f2841a019af4c73a1d7ae94f911 (patch) | |
tree | c18716840a672ae8cf9f0522683971de734eb645 | |
parent | f62be9d9757351280769f55fc0d4a86b238699cf (diff) |
Added a comment
-rw-r--r-- | doc/forum/how_to_prevent_accidentally_running___96__git_add__96____63__/comment_1_440dcd19ea2512f968858b780c2a2913._comment | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/forum/how_to_prevent_accidentally_running___96__git_add__96____63__/comment_1_440dcd19ea2512f968858b780c2a2913._comment b/doc/forum/how_to_prevent_accidentally_running___96__git_add__96____63__/comment_1_440dcd19ea2512f968858b780c2a2913._comment new file mode 100644 index 000000000..166d549fd --- /dev/null +++ b/doc/forum/how_to_prevent_accidentally_running___96__git_add__96____63__/comment_1_440dcd19ea2512f968858b780c2a2913._comment @@ -0,0 +1,22 @@ +[[!comment format=mdwn + username="Xyem" + ip="178.79.137.64" + subject="comment 1" + date="2014-06-25T10:35:07Z" + content=""" +I'm not sure if you can prevent 'git add' but you can at least prevent it getting commited with the pre-commit hook. Mine is this: + + #!/bin/sh + + FILES=$(find -name \".git\" -prune -o -type f -not -name \".gitignore\" -print); + FILE_COUNT=$(echo -n \"$FILES\" | wc -l) + + if [ $FILE_COUNT -gt 0 ]; then + echo \"$FILE_COUNT non-symlink files found.\" + echo \"$FILES\" + exit 1 + fi + + # automatically configured by git-annex + git annex pre-commit . +"""]] |