4

I need to move current and ALL past revisions of a file in my repository, and then replace them with a new file. Basically, without thinking, I forgot (and continuously forgot) to remove the mysql password for the database connection file, and would like to remove any traces of this.

The simplest fix would be to change the mysql password and from this point on, do not include the password in the file, however, I'd like to just clean up the revision history.

drewrockshard
  • 2,043
  • 10
  • 35
  • 47
  • 1
    Not sure how to do this, so I won't add this as an answer, but I'm concerned given the distributed nature of Git that even if you push a new file to a remote, all the other remotes will still have the old one. – Michael Shimmins Jan 22 '11 at 05:39

2 Answers2

5

See the previous answer: Remove sensitive files and their commits from Git history

git filter-branch to the rescue: http://git-scm.com/docs/git-filter-branch

Beware that this will change all of the SHA-hashes of your commits, but that's OK if it's a personal project.

Community
  • 1
  • 1
Conrad Irwin
  • 1,312
  • 8
  • 13
1

Github has a help section dedicated to this issue. I actually used it before and find it very useful.

ryanprayogo
  • 11,587
  • 11
  • 51
  • 66