Created
March 24, 2015 13:20
-
-
Save nowox/0ee91465d94a52f6cd3e to your computer and use it in GitHub Desktop.
Improve workflow with Git and BeyondCompare
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
#!/usr/bin/bash | |
#File: git-diffbeyond | |
#Author: Yves Chevallier <[email protected]> | |
#Date: 2015-03-24 Tue 02:16 PM | |
head="HEAD~1" | |
# Create temporary folder | |
OUT="$(mktemp -d)" | |
# Copy current files into this folder | |
cp -v --parents `git ls-files` $OUT | |
# Copy old files from HEAD | |
for file in $( git diff --name-only ); do git show $head:$file > $file.old && cp $file.old $OUT/$file; done | |
# Create BCompare filter | |
ignored="$(git check-ignore ** | perl -ne 'chomp; next unless -f; s/([()])/\\$1/g; print "-$_;";')" | |
untracked="$(git ls-files --others --exclude-standard | perl -ne 'chomp; next unless -f; s/([()])/\\$1/g; print "-$_;";')" | |
git="-.git/;" | |
# Execute BCompare | |
left="$( cygpath -wa . )" | |
right="$( cygpath -wa $OUT )" | |
/cygdrive/c/BeyondCompare3/Bcomp /filters=$git$ignored$untracked $left $right |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment