From: Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
To: Gennady Kushnir <genkush@rujel.net>
Cc: git@vger.kernel.org
Subject: Re: Removing some files from history
Date: Fri, 17 Oct 2008 12:52:26 +0200 [thread overview]
Message-ID: <48F86E6A.7080102@fastmail.fm> (raw)
In-Reply-To: <96ed5eac0810170338s292fe858s1c092428a44a7ad2@mail.gmail.com>
Gennady Kushnir venit, vidit, dixit 17.10.2008 12:38:
> Hello all
> I'm not yet subscribed, but I wish I shall get reply anyway
>
> I'm going to make my repository public, but I have found that one of
> my files contains some private data that I would not like to share.
> Is it possible to remove that file from all commits in my local
> repository history before publishing it?
> Or it would be easier to start publishing with just my current state
> (whith all private data cleaned up)?
>
> Thanks in advance.
> Gennady
Use
git filter-branch --index-filter 'git rm --cached secret' -- --all
or
git filter-branch --tree-filter 'rm -f secret' -- --all
where 'secret' is the name of the file to be removed.
After that, make sure you clean up your repo before publishing:
Clean out the original references (command on 1 line):
git for-each-ref --format='%(refname)' refs/original |while read ref;
do git update-ref -d $ref;done
Clean out the reflog:
git reflog --expire=0 expire
Remove the old objects and packs:
git prune
git repack -adf
[Makes me feel this should be easier.]
Michael
next prev parent reply other threads:[~2008-10-17 10:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-17 10:38 Removing some files from history Gennady Kushnir
2008-10-17 10:42 ` Jeff King
2008-10-17 10:52 ` Michael J Gruber [this message]
2008-10-17 11:51 ` Gennady Kushnir
2008-10-17 12:20 ` Jakub Narebski
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=48F86E6A.7080102@fastmail.fm \
--to=michaeljgruber+gmane@fastmail.fm \
--cc=genkush@rujel.net \
--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).