Skip to content

Instantly share code, notes, and snippets.

@aplatypus
Last active August 4, 2021 12:56
Show Gist options
  • Save aplatypus/5ac6ba4bab2b145a3a24ef9760b836b4 to your computer and use it in GitHub Desktop.
Save aplatypus/5ac6ba4bab2b145a3a24ef9760b836b4 to your computer and use it in GitHub Desktop.
Git diff.external script ... Handles multiple file diffs. Git will make tempory a file(s) when it is comparing from the repository.
#!/bin/bash
# * expects meld to be on your default PATH
#
function detach_meld()
{
local f1="/tmp/mld1-$(basename "$1")"
local f2="/tmp/mld2-$(basename "$2")"
## echo "f1 = ${f1}"
## echo "f2 = ${f2}"
cp "$1" "${f1}"
cp "$2" "${f2}"
#
(meld --newtab "${f1}" "${f2}" ; rm "${f1}" "${f2}" ) > /dev/null 2>&1 &
}
detach_meld "$2" "$5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment