Skip to content

Instantly share code, notes, and snippets.

@yetti
Last active February 13, 2019 02:33
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 yetti/fdff27f15e602a902aeb9c1a2de4621e to your computer and use it in GitHub Desktop.
Save yetti/fdff27f15e602a902aeb9c1a2de4621e to your computer and use it in GitHub Desktop.
Sync SVN revision to Git commit notes after BFG clean on SubGit repository.
#!/bin/bash
path=$1
if [[ -n "$path" ]]; then
git fetch origin refs/svn/map:refs/notes/commits
cat $path | git notes copy --stdin
cat $path | cut -d' ' -f 1 | git notes remove --stdin
git notes prune
git update-ref refs/notes/commits $(git commit-tree refs/notes/commits^{tree} -m "notes squashed")
git fetch
git push origin +refs/notes/*:refs/notes/*
# git log --pretty=format:"%H %N" --show-notes * >> notes.log
# echo "commits with notes logged to notes.log"
else
echo "missing path to object-id-map.old-new.txt"
fi
Clean up unwanted stuff:
$ rm -rf refs/original
$ git fsck
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
$ git repack -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment