Created
February 17, 2025 13:35
-
-
Save baztian/84d1ff3a982e921f492454ebc9edcee8 to your computer and use it in GitHub Desktop.
Use diff-highlight instead the default diff for git if available
This file contains hidden or 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 | |
# Git pager script for using diff-highlight | |
# Path to the diff-highlight script | |
DIFF_HIGHLIGHT="/usr/share/doc/git/contrib/diff-highlight/diff-highlight" | |
# Check if diff-highlight is available and executable | |
if [ -f "$DIFF_HIGHLIGHT" ]; then | |
# Use diff-highlight in the pipeline | |
perl "$DIFF_HIGHLIGHT" | less -r | |
else | |
# Fallback to regular less if diff-highlight is not available | |
less -r | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use like this in your ~/.gitconfig