Skip to content

Instantly share code, notes, and snippets.

@mike-perdide
Created January 11, 2011 22:10
Show Gist options
  • Select an option

  • Save mike-perdide/775263 to your computer and use it in GitHub Desktop.

Select an option

Save mike-perdide/775263 to your computer and use it in GitHub Desktop.
My attempts at making git-filter-branch work on a limited list of commits
I patched git-filter-branch to see what command where executed (so mainly I added set -x in a few spots)
Here are my last 10 commits :
[celest.qGitFilter//master]% git-rev-list HEAD |head
dfa87ccef0c825e0ad3546d64135ceafb92647b8
424a7ab28c259a1746c4748ce7deb1e4f7ed0f57 (I'll be trying to filter from this commit)
01ccee851c8bec6f247d018676464ba3deec95ae
d730a84fc935a67608b625dbd3ff0884fbf245d1
b96f6790a480b803860dee471d1f9361853d0613 (to this one)
1e345f114714f7ea666db97597d08b723d129156
7d2a09fcefdbc21fd37a0f5a83e7ab293bab0d1b
e7d3407bdfb1373e1843405696901081bf4c3b37
ed11cd69063de38c5289e16212832f7e4a5eaaf1
c394c93ebab1d908bbe04718b54f81b35a06db03
[celest.qGitFilter//master]% git-filter-branch b96f6790a480b803860dee471d1f9361853d0613..424a7ab28c259a1746c4748ce7deb1e4f7ed0f57
+ git rev-parse --no-flags --revs-only --symbolic-full-name --default HEAD b96f6790a480b803860dee471d1f9361853d0613..424a7ab28c259a1746c4748ce7deb1e4f7ed0f57
Which ref do you want to rewrite?
(here rev-parse can't find the ref, so I use glob=pattern to force it)
[celest.qGitFilter//master]% git-filter-branch b96f6790a480b803860dee471d1f9361853d0613..424a7ab28c259a1746c4748ce7deb1e4f7ed0f57 \
--glob="refs/heads/master*"
+ git rev-parse --no-flags --revs-only --symbolic-full-name --default HEAD b96f6790a480b803860dee471d1f9361853d0613..424a7ab28c259a1746c4748ce7deb1e4f7ed0f57 --glob=refs/heads/master*
+ git rev-parse --revs-only b96f6790a480b803860dee471d1f9361853d0613..424a7ab28c259a1746c4748ce7deb1e4f7ed0f57 --glob=refs/heads/master*
+ rev_args=424a7ab28c259a1746c4748ce7deb1e4f7ed0f57
^b96f6790a480b803860dee471d1f9361853d0613
dfa87ccef0c825e0ad3546d64135ceafb92647b8
+ git rev-list --reverse --topo-order --default HEAD --parents --simplify-merges 424a7ab28c259a1746c4748ce7deb1e4f7ed0f57 ^b96f6790a480b803860dee471d1f9361853d0613 dfa87ccef0c825e0ad3546d64135ceafb92647b8
(this gives me a list of the four top commits, so it looks like the script accepted to limit the list with the min commit, but not with the max)
I tried some other things (like --until, --since), but I can't see how I could get git rev-list to receive something like commit1..commit2, which seems to be the only way to obtain a limited commit list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment