Re: Really remove a file ?
- From
Stefan Karpinski <stefan.karpinski@gmail.com>
- Date
- Oct 9, 2008, 23:43 UTC
- Message-ID
- <d4bc1a2a0810091643u3903a1f4h44d3579b98fe6922@mail.gmail.com>
- In-Reply-To
- <81b0412b0810091156v15dea27an95050a06cfb4f8df@mail.gmail.com>
Specifically, you probably want to do something like this:
$ git filter-branch --index-filter 'git update-index --remove <filename>' --force -- --all
Beware that this will make your repository effectively "incompatible" with those of others who've pulled from you before—because all of your history is now completely rewritten. You should probably have them clone a new copy from the repo you've run this on instead of trying to continue working with their old repos. Otherwise all hell breaks loose. You'll probably also want to run "git gc" on your repo to actually get rid of the huge object that was added (or does filter-branch do this automatically?).
On Thu, Oct 9, 2008 at 11:56 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 15 quoted lines
> > 2008/10/9 <marcreddist@aim.com>: > > So is there a way to really remove a file in the git repository so that it > > never existed (I mean not having the diff in the logs and the data stored > > somewhere in the .git directory) ? Or if it's not the was git is supposed to > > be used, is there a way to hide the diff (even from git-log) or something ? > > Yes. But you'll change the whole history (of course, it should _never_ > mention the file). > See git filter-branch (there is even an example at the end of its man page. > Replace mv with rm) > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html