Scripts to fix the broken commits in this repo

The result of this can be pushed to github and passes a "git fsck"
Merge pull request #960 from djs55/fix-broken-repo

Scripts to fix the broken commits in this repo