I try to put the output of 'git diff' into a variable in shell script to check if file has changed, but whenn running 'git diff file' in script I always get this output:
usage: git diff [--no-index] <path> <path>
here is what i am calling in the script
#!/bin/sh
cd /path/to/repo
jsdiff=`git diff file.js`
echo "jsdiff: $jsdiff"
any ideas?
#!/bin/sh
#
# this script is always executed before the commit is typed
#
#
# Before commiting minify and compress javascript if changed
cd /path/to/repo/_js
jsdiff=`git diff main.js`
echo "jsdiff: $jsdiff"
#if [ "$jsdiff" != "" ]
# then
# compile js
# ./googleClosureCompile.sh
# echo "js minified"
#fi
exit 0;
/path/to/file/file.jsexists? If you replacegit diffwithls -l, does it work?git diff?apt-get install- it worked :(git diffnot inside a git repo. Are you sure you don't docdor something like this before it? Show us your wholepre-commit.