19 lines · 799 B · Text
RawDownload
#!/bin/sh# A sample hook to prevent commits with merge-markers###################################################### This example hook rejects changes that are about to be committed with merge markers,# as that would be a clear indication of a failed merge. It is triggered by `git commit`# and returning with non-zero exit status prevents the commit from being created.## To enable this hook remove the `.sample` suffix from this file entirely. # Check for merge markers in modified filesfor file in $(git diff --cached --name-only); do    if grep -q -E '^(<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|)$' "$file"; then        echo "Error: File '$file' contains merge markers. Please remove them before committing."        exit 1    fidone # Exit with success if there are no errorsexit 0

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t