]>
git.proxmox.com Git - rustc.git/blob - vendor/gix/src/assets/init/hooks/pre-commit.sample
2 # A sample hook to prevent commits with merge-markers
3 #####################################################
4 # This example hook rejects changes that are about to be committed with merge markers,
5 # as that would be a clear indication of a failed merge. It is triggered by `git commit`
6 # and returning with non-zero exit status prevents the commit from being created.
8 # To enable this hook remove the `.sample` suffix from this file entirely.
10 # Check for merge markers in modified files
11 for file in $
(git
diff --cached --name-only); do
12 if grep -q -E '^(<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|)$' "$file"; then
13 echo "Error: File '$file' contains merge markers. Please remove them before committing."
18 # Exit with success if there are no errors