Re: Removing some files from history

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux