Preventing from pushing too large feature branches

When you’re assigned to a pull request that has dozens of files and hundred of changes it’s for sure that most of the review will not be done thoroughly. You can’t just ‘process’ that amount of information without being borded on the way. You can, instead, harness some ‘guard’ that will prevent that misbehaviour. This can be done on git pre-push hook, but Travis would be a better choice. See:

# .git/hooks/pre-push
limit=1000
count=$(git diff head --not master --shortstat |  sed "s/[^[:digit:].-]/ /g" | awk '{ print $2+$3 }')

if [ $count -ge $limit ]; then
	echo 'Too many changes! Please reduce the size of the pull request'; exit 1
else
	exit 0
fi

603 seconds