git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Gelonida <gelonida@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: how to squash a few commits in the past
Date: Thu, 06 May 2010 08:45:49 +0200	[thread overview]
Message-ID: <4BE2659D.2070208@viscovery.net> (raw)
In-Reply-To: <loom.20100503T112508-677@post.gmane.org>

Am 5/3/2010 11:33, schrieb Gelonida:
> One of the team members accidentally commited a very huge file together with
> some useful sources.
> a few commits later he noticed his error and removed the huge file.
> 
> The plan would be:
> - create a new git repository without the huge file
> - let everybody clone the new repository and continue working.

Use 'git filter-branch':

  git filter-branch \
    --index-filter 'git rm --ignore-unmatch --cached the/huge/file' \
    --prune-empty \
    -- --all

The --prune-empty removes the commit that removed the file from the
history if the removal of the/huge/file was the only thing it did.

If you have tags that must be rewritten, add "--tag-name-filter cat" to
the command before "--".

Try this in a backup copy or clone first!

-- Hannes

      parent reply	other threads:[~2010-05-06  6:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03  9:33 how to squash a few commits in the past Gelonida
2010-05-03 10:09 ` Michael J Gruber
2010-05-03 20:45   ` Gelonida
2010-05-03 20:55     ` Gelonida
2010-05-03 21:20     ` Gelonida
2010-05-05 13:19       ` Ramkumar Ramachandra
2010-05-05 21:41         ` Gelonida
2010-05-06  6:45 ` Johannes Sixt [this message]

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=4BE2659D.2070208@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=gelonida@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 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).