From: Peter Waller <peter.waller@gmail.com>
To: git@vger.kernel.org
Subject: Git filter branch - removing empty commits
Date: Mon, 6 Oct 2008 07:57:22 -0700 (PDT) [thread overview]
Message-ID: <19839587.post@talk.nabble.com> (raw)
Dear List,
I have removed lots of files from my history with a procedure something like
this:
1) Clone repository
2) git filter-branch --index-filter 'git rm --quiet -r Archive; git ls-files
-z '\''*.png'\'' '\''*.eps'\'' | xargs -0r git rm --quiet; true'
3) git reflog expire --expire=0 --all
4) git prune; git gc
The problem is that this leaves many empty commits.
The helpful people over at #git advised I do:
git filter-branch --commit-filter 'if [ z$1 = z`git rev-parse $3^{tree} 2>
/dev/null` ]; then skip_commit "$@"; else git commit-tree "$@"; fi'
But this gets to about commit 70/1300 and grinds to a halt. I modified
/usr/libexec/git-core/git-filter-branch to say #!/bin/sh -x, and the result
was over 80mb in a few seconds.
I have pasted the last few lines here:
http://rafb.net/p/ABWvCy44.html
It is like it is following some exponential behaviour and not getting
anywhere.
Any ideas what is wrong?
I have tried a couple of scripts I have found around that should do the same
thing, for example:
skip_commit()
{
shift
while [[ -n $1 ]] ; do
shift
map "$1"
shift
done
}
our_tree="$1"
our_parent_tree=$(map $3)
if [[ ${our_tree} == $(git rev-parse $(map $3)) ]]; then
git commit-tree "$@"
else
skip_commit "$@"
fi
This goes much faster, but when it reaches the final commit, it says this:
Ref 'refs/heads/master' was deleted
fatal: Not a valid object name HEAD
And not much useful seems to have happened.
Any help appreciated.
Regards,
- Peter
--
View this message in context: http://www.nabble.com/Git-filter-branch---removing-empty-commits-tp19839587p19839587.html
Sent from the git mailing list archive at Nabble.com.
reply other threads:[~2008-10-06 14:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19839587.post@talk.nabble.com \
--to=peter.waller@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.