开发者

Git: Remove all revisions of a file in a repository, and replace with new file

开发者 https://www.devze.com 2023-02-06 16:32 出处:网络
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 pass

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 simples开发者_运维技巧t 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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号