git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Question on git-filter-branch

From
Bill Lear <rael@zopyra.com>
Date
Nov 1, 2007, 13:19 UTC
Message-ID
<18217.53833.710503.667761@lisa.zopyra.com>
In-Reply-To
<20071101125845.GA27567@glandium.org>
On Thursday, November 1, 2007 at 13:58:45 (+0100) Mike Hommey writes:
Show 29 quoted lines
>On Thu, Nov 01, 2007 at 06:55:37AM -0600, Bill Lear wrote:
>> In my repo, I have sensitive files A, C, and a directory full of
>> sensitive stuff I want to remove forever from the git repository.
>> 
>> % ls
>> A B C D sensitive_stuff
>> 
>> % git --version
>> git version 1.5.3.5
>> 
>> % git filter-branch --index-filter 'git update-index --remove A' HEAD
>> Rewrite 5dd7d5f2d7d3a5f43c242188ac96294628267673 (7/7)
>> Ref 'refs/heads/master' was rewritten
>> 
>> These refs were rewritten:
>> % ls
>> B  C  D  sensitive_stuff
>> 
>> % git status
>> # On branch master
>> nothing to commit (working directory clean)
>> 
>> Ok, so I guess it has done what I wanted.  So, I try to remove the
>> next file that has sensitive information in it:
>> 
>> % git filter-branch --index-filter 'git update-index --remove C' HEAD
>> Namespace refs/original/ not empty
>
>Just remove .git/refs/original/
Ok, thanks.  But, how do I remove the subdirectory?
% rm -rf .git/refs/original
% git filter-branch --index-filter 'git update-index --remove sensitive_stuff' HEAD
Rewrite 6711f6a50605918326f67ca0c3402eab9a4c8571 (8/8)
WARNING: Ref 'refs/heads/master' is unchanged
% ls sensitive_stuff
E  F  G
% git filter-branch --index-filter 'git update-index --remove sensitive_stuff/*' HEAD
Rewrite 6711f6a50605918326f67ca0c3402eab9a4c8571 (8/8)
WARNING: Ref 'refs/heads/master' is unchanged

% ls sensitive_stuff E F G

% cd sensitive_stuff % git filter-branch --index-filter 'git update-index --remove E F G' HEAD fatal: Not a git repository: '.git' You need to run this command from the toplevel of the working tree.

Bill
Previous: Mike HommeyNext: Mike Hommey
Message 3 of 6 in “Question on git-filter-branch”
  1. Bill LearNov 1, 2007
  2. Mike HommeyNov 1, 2007
  3. Bill LearNov 1, 2007
  4. Mike HommeyNov 1, 2007
  5. Bill LearNov 1, 2007
  6. Alex RiesenNov 1, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.