diff --git a/devTools/BuildAndIPFSify.sh b/devTools/BuildAndIPFSify.sh
index 2243f7ed6f026baf6bc4b1987d6256a69187655a..1c2919cfb7141f6ca3c37fb351fa3758743c6cb5 100755
--- a/devTools/BuildAndIPFSify.sh
+++ b/devTools/BuildAndIPFSify.sh
@@ -5,6 +5,8 @@
 # */15 * * * * cd ~/FC/fc-pregmod && git pull --ff-only origin pregmod-master > ~/FC/git_pull.log 2>&1
 # and do "ln -s ~/FC/fc-pregmod/devTools/BuildAndIPFSify.sh .git/hooks/post-merge"
 
+rm bin/*.html
+
 # if this script is used as the post-merge hook then
 # a) git pull has pulled something
 # b) $PWD is fc-pregmod
@@ -12,11 +14,22 @@ if [ "$(basename "$0")" != "post-merge" ]; then
 	# cd to fc-pregmod based on where this script is
 	cd "$(readlink -f "$(dirname "$0")")/.." || exit 1
 	git pull
+	# if there are new html files then git probably pulled something and ran this script as a post-merge hook
+	if ls bin/*.html; then
+		exit 0
+	fi
+fi
+
+# If we've done this before then unpin the previous hash so IPFS can GC it if it needs to
+if [ -r ../IPFS_hash.txt ]; then
+	ipfs pin rm --recursive=true "$(cut -d : -f 2 ../IPFS_hash.txt)"
 fi
 
-rm bin/*.html
 ./compile || exit 1
 
+# Keep the build time from changing the hash of the file
+sed -Ei -e '/^  \* Built on .+$/d' bin/*.html
+
 # add the date of the last commit to the file, but don't use colons because Windows (still?) doesn't like them
 mv bin/*.html "bin/FC pregmod $(git log -1 --format='%cd' --date='format:%F %H-%M').html"
 
@@ -27,6 +40,7 @@ if [ -e ../resources ]; then
 else
 	ipfs_hash="$(ipfs add -w -Q bin/*.html)"
 fi
+echo "IPFS Folder Hash: ${ipfs_hash}" > ../IPFS_hash.txt
 ipfs name publish "$ipfs_hash"
 
 # when it's done it will print something like "Published to $your_pubkey: /ipfs/$ipfs_hash"