Skip to content

Instantly share code, notes, and snippets.

@kunicmarko20
Last active February 15, 2023 08:30
Show Gist options
  • Save kunicmarko20/4ac45ae65d21eb524a7fc441f885712f to your computer and use it in GitHub Desktop.
Save kunicmarko20/4ac45ae65d21eb524a7fc441f885712f to your computer and use it in GitHub Desktop.

Revisions

  1. kunicmarko20 revised this gist Jun 2, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pre-commit
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,6 @@ top_level_path="$(git rev-parse --show-toplevel)";
    while read file_name; do
    if grep -q "// warn-before-commit" "$top_level_path/$file_name"; then
    git reset $file_name;
    echo "File $file_name, was not commited because 'warn-before-commit string' was found."
    echo "File $file_name, was not commited because 'warn-before-commit' string was found."
    fi
    done < <(git diff --cached --name-only --diff-filter=ACM)
  2. kunicmarko20 created this gist Jun 2, 2020.
    10 changes: 10 additions & 0 deletions pre-commit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    top_level_path="$(git rev-parse --show-toplevel)";

    while read file_name; do
    if grep -q "// warn-before-commit" "$top_level_path/$file_name"; then
    git reset $file_name;
    echo "File $file_name, was not commited because 'warn-before-commit string' was found."
    fi
    done < <(git diff --cached --name-only --diff-filter=ACM)