Skip to content

Instantly share code, notes, and snippets.

@avar
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avar/497c8c8fbd641fb756ef to your computer and use it in GitHub Desktop.
Save avar/497c8c8fbd641fb756ef to your computer and use it in GitHub Desktop.
Ad-hoc benchmark script for git fetch --prune v.s. git remote prune
#!/bin/bash -xe
# Clone git.git
cd /tmp/
rm -rf git
if ! test -d git
then
git clone --reference ~/g/git https://code.google.com/p/git-core/ git
fi
# Create a bunch of branches in it
cd git
for i in {1..1000}
do
git branch test-$i origin/master || :
done
# Clone that repo again locally
cd /tmp
rm -rf git-fetch git-remote-prune
git clone --no-hardlinks file:///tmp/git git-fetch
cp -Rv git-fetch git-remote-prune
# Delete the branches in the original clone
cd /tmp/git
git branch -l|grep test-|sed 's/^ /git branch -d /'|sh -x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment