Skip to content

Instantly share code, notes, and snippets.

@furnox
Last active March 9, 2025 08:49
Show Gist options
  • Save furnox/663efaa3633832465beac664748778d0 to your computer and use it in GitHub Desktop.
Save furnox/663efaa3633832465beac664748778d0 to your computer and use it in GitHub Desktop.
Includes new files along with git diff
#!/bin/bash
if [ "$#" -eq 0 ]; then
( git diff --staged --color=always; git diff --color=always; git ls-files --others --exclude-standard | while read -r i; do if [[ -f $i ]]; then git diff --color=always -- /dev/null "$i"; fi; done ) | less -r
else
git diff "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment