git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Klas Lindberg" <klas.lindberg@gmail.com>
To: "Michael J Gruber" <git@drmicha.warpmail.net>
Cc: "Jakub Narebski" <jnareb@gmail.com>,
	"Steven Grimm" <koreth@midwinter.com>,
	"Git Users List" <git@vger.kernel.org>
Subject: Re: How to remove a commit object?
Date: Thu, 2 Oct 2008 16:52:57 +0200	[thread overview]
Message-ID: <33f4f4d70810020752g4738fee3p4e99ab417d97106a@mail.gmail.com> (raw)
In-Reply-To: <48E4DB21.7020304@drmicha.warpmail.net>

What I really want is to remove files, but when filter-branch didn't
seem to do what I wanted, I turned to the idea of rewriting single
commits to not include the files in question.

This is what I tried with filter-branch: gitk --all shows about 170
commits on directory D in the repo. Of these, maybe 10 don't lead to
HEAD, but dangle off the main track. As a test, I decided to let
filter-branch create a new repo that only contained the contents of
subdirectory B. So I ran

    git-filter-branch --subdirectory-filter B -- --all

and now the resulting repo has just 14 commits. This is clearly not
what I wanted because a lot of the original history for subdirectory B
is just missing.

Actually, in this particular case I get the exact same result with

    git-filter-branch --subdirectory-filter B HEAD

BR / Klas

On Thu, Oct 2, 2008 at 4:30 PM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> Klas Lindberg venit, vidit, dixit 02.10.2008 16:26:
>> Repo size is a problem too, actually.
>>
>> A solution to both problems seemed to be to use git-filter-branch to
>> create a new repo by filtering out all the unwanted files. The
>> astonishing result was that, for the subdirectory I tried it on, 90%
>> or so of the commits on that subdirectory just disappeared. It didn't
>> look right at all. Although I can't say for sure exactly what I did
>> with filter-branch, I would appreciate some guidance for using it. It
>
> I don't know about others, but I would appreciate more info:
> Do you want to remove commits (as stated earlier) or files (as stated here)?
> What are the boundary conditions? Rewriting history seems to be OK now.
>
>> basically seemed to do exactly what I wanted (recreate the repo, minus
>> some explicit stuff, with history intact otherwise), except the result
>> looked crazy.
>
> That may be due to the filter-branch incarnation, i.e. which refs did
> you rewrite (--all or HEAD)?
>
> Michael
>

  reply	other threads:[~2008-10-02 14:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 23:41 How to remove a commit object? Steven Grimm
2008-09-19  9:16 ` Michael J Gruber
2008-10-02 13:36   ` Klas Lindberg
2008-10-02 14:00     ` Michael J Gruber
2008-10-02 14:02     ` Jakub Narebski
2008-10-02 14:26       ` Klas Lindberg
2008-10-02 14:30         ` Michael J Gruber
2008-10-02 14:52           ` Klas Lindberg [this message]
2008-10-02 15:02         ` Johannes Sixt
2008-10-03 11:42           ` Klas Lindberg
2008-10-03 12:03             ` Johannes Sixt

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=33f4f4d70810020752g4738fee3p4e99ab417d97106a@mail.gmail.com \
    --to=klas.lindberg@gmail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=koreth@midwinter.com \
    /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).