Created
November 25, 2020 20:36
-
-
Save ObjectBoxPC/7c70e7657b42c542f0ba2cdf9145172b to your computer and use it in GitHub Desktop.
"git sct" script ("show commit with tool") to view the changes made in a commit using a diff tool
This file contains 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 | |
# To integrate, place the following into your .gitconfig: | |
# [alias] | |
# sct = !path/to/git-sct.sh | |
if [ $# -lt 1 ]; then | |
echo "Usage: git sct <revision> [<parent-number>]" | |
exit 1 | |
fi | |
REVISION="$1" | |
PARENT_NUMBER="$2" | |
exec git difftool "$REVISION^$PARENT_NUMBER" "$REVISION" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can actually be replaced by the following alias:
sct = !sh -c 'git difftool "$0^${1:-1}" "$0"'