git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christof Krüger" <git@christof-krueger.de>
To: "Shantanu Pavgi" <pavgi@uab.edu>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: removing files from history but not filesystem
Date: Tue, 28 Jun 2011 09:04:59 +0200 (CEST)	[thread overview]
Message-ID: <218bf1d3b2bf197a5f56d542c6a91960.squirrel@mail.localhost.li> (raw)
In-Reply-To: <CFCCFA00-B4BF-4A88-88A5-2F588630F7BB@uab.edu>

Hi,

> $ git filter-branch --index-filter 'git rm --cached --ignore-unmatch
> */one.txt' HEAD

The following should work:

git branch temp
git filter-branch --index-filter 'git rm --cached --ignore-unmatch foo' temp
git reset temp

This creates branch "temp" pointing to the same commit as "master".
Then you filter-branch the "temp" branch. This leaves file "foo" in your
working directory intact, as your current branch is actually "master". The
third step resets your current "branch" to the commit pointed by the
rewritten branch "temp". The default for git reset is --mixed which
according to the man page leaves the working tree alone.

Regards,
  Chris

  reply	other threads:[~2011-06-28  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-28  6:13 removing files from history but not filesystem Shantanu Pavgi
2011-06-28  7:04 ` Christof Krüger [this message]
2011-06-29  4:10   ` Shantanu Pavgi
2011-06-29  6:08     ` Christof Krüger
2011-06-29 16:57       ` Christof Krüger
2011-06-29 21:45       ` Shantanu Pavgi

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=218bf1d3b2bf197a5f56d542c6a91960.squirrel@mail.localhost.li \
    --to=git@christof-krueger.de \
    --cc=git@vger.kernel.org \
    --cc=pavgi@uab.edu \
    /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).