On Monday, August 19, 2013 10:53:34 AM UTC-7, Konstantin Khomoutov wrote:
> On Mon, 19 Aug 2013 10:04:33 -0700 (PDT)
> > At some point I added a large file into a git repository.
> > It now exists on multiple branches, possibly with some
> > changes to it. I'd like to remove it from git, but leave its
> > current form (say the one on the master branch) on the
> > file system.
> > I tried (on a dummy git archive)
> > git filter-branch --index-filter 'git rm --cached --ignore-unmatch
> > bigfile' master branch1 branch2
> > That, however, does not leave a copy of bigfile on the file system.
> > It isn't clear to me why not, though the description of the
> > --tree-filter option to filter-branch (I'm using the --index-filter
> > option, but is is "similar") states:
> > " (new files are auto-added, disappeared files are
> > auto-removed ... )".
> > Is there a direct way to do what I want, with git? I've found
> > similar requests;
> > none of the responses point out that the above command actually
> > deletes the file from the file system.
> I'm with Dale on this issue, but why do you consistently mention "file
> system"? If you want `git filter-branch` to keep your file on your file
> system, just copy it yourself from the project's work tree somewhere
> else, and after filtering your branches, move it back to the work
> tree, then make it a part of a commit on the relevant branch.
> What's the problem?
> If you wonder why the file disappears from the work tree during the
> filtering process, my take on it is that 1) the work tree is used as a
> scratch space during the filtering, and 2) the work tree (normally)
> contains the same state HEAD does, so if filtering deleted the file
> from HEAD it's logical the work tree does not contain it as well.
I wonder because
git rm --cached bigfile
does *not* remove the file from the working directory. It's not clear,
why the file is removed in the filter-branch call. What is the point of
passing --cached to the call to git rm in the --index-filter command? Is it
merely for efficiency? It seems to have the same effect without it. That
is not the case when using git rm alone:
git rm bigfile
removes the file from working directory as well as the index.
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/groups/opt_out.