6

I've started switching my private subversion projects to git (Github) and release the code to the public. Therefore, I am a git newbie.

Unfortunately, there is a revision of a project that contains confidential data. The revision is not tagged, I just know its hash value.

Is there a way to completely erase that particular revision from the remote git repository? It is a solo project, so nobody will be harmed from the operation.

  • See "Removing sensitive data" at GitHub: http://help.github.com/removing-sensitive-data/ – Greg Bacon Feb 14 '10 at 19:57
  • Possible duplicate: http://stackoverflow.com/questions/872565/how-do-i-remove-sensitive-files-from-gits-history – Greg Bacon Feb 14 '10 at 19:58
  • the tutorial you are linking does not provide a solution for my problem. It just deletes the file from all revisions. I do not want to delete the file, I just want to delete the revision. Anyway, I was able to find the solution by googling, finding another SO question. –  Feb 14 '10 at 21:04
  • What do you mean by "remote"? If it's a solo project, why is there a "remote" repo? Or is this the one people pull from? If it is solo, then can't you just delete (as in filesystem delete, or reset back to the first commit and fast forward it, etc) the "remote" git repo, and just replace it with your modified version? :) Of course, this assumes you know how to delete a revision from your local repository? – Pod Feb 14 '10 at 13:36
  • It used to be a solo project because I'm opening the code right now. I imported the repository by following the tutorial on http://github.com/guides/import-from-subversion Then I realized that there was a commit containing confidential data. I don't know how to delete only that revision from both github and my local clone. I opened the repository on github, so the code is mine (and will be released under GPLv3 license) –  Feb 14 '10 at 13:42

1 Answers1

4

The post located here solved my problem.

If the commit you want to fix isn’t the most recent one:

  1. git rebase --interactive $parent_of_flawed_commit

    If you want to fix several flawed commits, pass the parent of the oldest one of them.

  2. An editor will come up, with a list of all commits since the one you gave.

    1. Change pick to edit in front of any commits you want to fix.
    2. Once you save, git will replay the listed commits.
  3. Git will drop back to the shell for every commit you said you want to edit:

    1. Change the commit in any way you like.
    2. git commit --amend
    3. git rebase --continue

Most of this sequence will be explained to you by the output of the various commands as you go. It’s very easy, you don’t need to memorise it – just remember that git rebase --interactive lets you correct commits no matter how long ago they were.

Community
  • 1
  • 1