5 ms·
Something I came up with when deploying updates to hosts that don't support git, for example, a windows server we have RDC into: alias gdate=date\ +%Y.%m.%d-
by DCoder 16y ago
Something I came up with when deploying updates to hosts that don't support git, for example, a windows server we have RDC into:
alias gdate=date\ +%Y.%m.%d-%H.%M.%S
gitzip () { zip -ruv "$(gdate).zip" $(git diff $@ --name-only); }
Produces a zip file of all files that changed since the commit you pass as the argument. Then I just transfer the resulting zip over, and unzip its contents to the root project folder. Haven't figured out how to deal with deleted files this way yet, fortunately that's not common.
--
And a pre-commit hook for linting PHP source code when I'm not in an IDE. Yes, this came around because of a few commits made without testing.
#!/bin/sh
exitStatus=0
for i in $(git diff --name-only --staged HEAD); do
[ "$VERBOSE" != "" ] && echo "Validating file $i"
echo "$i"| grep -q '.php$'
if [ $? -eq 0 ]; then
[ "$VERBOSE" != "" ] && echo "... seems to be PHP, running php lint"
php -n -l "$i"| grep -q 'Errors parsing'
valid=$?
if [ $valid -eq 0 ]; then
echo "File $i is invalid."
exitStatus=1
fi
fi
done
exit $exitStatus