Skip to content

Instantly share code, notes, and snippets.

@jensendarren
Created July 9, 2015 04:16
Show Gist options
  • Save jensendarren/e5614e19db0dcf96fa44 to your computer and use it in GitHub Desktop.
Save jensendarren/e5614e19db0dcf96fa44 to your computer and use it in GitHub Desktop.
Git diff which includes new files
if test "$#" = 0; then
(
git diff
git ls-files --others --exclude-standard |
while read -r i; do git diff -- /dev/null "$i"; done
)
else
git diff "$@"
fi
@jensendarren
Copy link
Author

Note to get this working, first create a Git Custom Command: 'git-diff-new' by following these steps:
http://thediscoblog.com/blog/2014/03/29/custom-git-commands-in-3-steps/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment