Re: removing content from git history

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

 



Michael Hendricks <michael@xxxxxxxxx> wrote:
> Is it possible to remove content entirely from git's history?

No, not once it has been published around to another repository.
Since every developer has a copy of the repository its very difficult
to remove something, as it must be removed from every developer's
repository, and each developer must perform an action to agree to
that removal.  So just one hold-out will keep the bad content around.

> I have a
> client who does not use git for version control.  A couple months ago
> they committed some sensitive client information which should never have
> been committed.  Recently, they realized the mistake and now want to
> remove all traces of the mistake from history.
> 
> I would like to migrate them to git at some point.  However, if they had
> been using git for version control already, I'm not sure how I would
> solved this particular problem.  Any suggestions?

The *only* way to do this in Git is to completely recreate every
commit after that point.  This changes all commit IDs and basically
forks the project into two completely different histories: the
one with the bad thing in it, and the one without the bad thing.
Users who have the bad thing will continue to have the bad thing
until they take explicit action to throw away all of that history
and switch to the other one.

Now this is actually not a huge deal if you do it on your local
repository and go "whoops, I should not have committed that".  If you
have not yet pushed the commit to another repository (and someone
has not yet fetched it from you either) you can use git-rebase to
discard it.  But once its been pushed/fetched the genie is out of
the bottle, and its not going back in.

-- 
Shawn.
-
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]