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
Written by Wojtek Ryrych
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#