Skip to content

Instantly share code, notes, and snippets.

@lotharthesavior
Created April 30, 2020 18:20
Show Gist options
  • Save lotharthesavior/9f9b277722bff816fc6eba19fa49ac5f to your computer and use it in GitHub Desktop.
Save lotharthesavior/9f9b277722bff816fc6eba19fa49ac5f to your computer and use it in GitHub Desktop.
Diff 2 strings with Git Diff
#!/bin/bash
git diff $(echo $1 | git hash-object -w --stdin) $(echo $2 | git hash-object -w --stdin) --color-words=.
@lotharthesavior
Copy link
Author

Usage:

sh diffstring.sh "string one" "string two"

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