From: worley@alum.mit.edu (Dale R. Worley)
To: git@vger.kernel.org
Subject: Using filter-branch without messing up the working copy
Date: Thu, 3 Oct 2013 11:07:09 -0400 [thread overview]
Message-ID: <201310031507.r93F79ci003282@hobgoblin.ariadne.com> (raw)
I'm working on using "git filter-branch" to remove the history of a
large file from my repository so as to reduce the size of the
repository. This pattern of use is effective for me:
1. $ git filter-branch --index-filter 'git rm --cached --ignore-unmatch core.4563' HEAD
2. edit .git/packed-refs to remove the line
"c6589bef2c776277407686a3a81c5a76bfe41ba2 refs/original/refs/heads/hobgoblin"
(so that there is no reference to the old HEAD)
3. git gc --quiet --aggressive
The difficulty I am having is that I do not want to disturb the
working copy while doing this. The working copy is my entire home
directory, because I am using the repository as a historical backup
system for my home directory. Currently, Git will not execute
filter-branch if there are unstaged changes in the working copy,
despite the fact that "git filter-branch --index-filter" does not
touch the working copy itself. (In this case, the file to be deleted,
"core.4563", is not now in the working copy.)
A further difficulty is that the repository is "remote", the .git
directory is not in my home directory, and core.worktree is
"/home/worley".
The best set of steps I have found that accomplishes my goals is to
(1) "disconnect" the repository from the working copy by removing the
core.worktree value, (2) use "git checkout -q -f master" to create in
the repository's location an entire copy of my home directory, (3)
perform the above filtering steps, (4) "reconnect" the repository by
adding the core.worktree value, and (5) deleting the temporary working
copy files.
Surely there is a better way than this.
Dale
reply other threads:[~2013-10-03 15:14 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=201310031507.r93F79ci003282@hobgoblin.ariadne.com \
--to=worley@alum.mit.edu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).