Removing private information from old Git commits

前端 未结 2 1751
一向
一向 2021-02-13 09:00

I have a project versioned with Git that I\'d like to make open source, but it has some private information in it that is specific to the environment in which it was originally

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 09:51

    I wrote a script for this a little while ago. You can find it here: https://gist.github.com/dound/76ea685c05c4a7895247457eb676fe69

    (original writeup viewable from archive.org: https://web.archive.org/web/20160208235904/http://dound.com:80/2009/04/git-forever-remove-files-or-folders-from-history/)

    The script builds on the git-filter-branch tool which comes with git. If you're curious, you can read more about removing files from a git repo here, but using the script from the link above should be easy and all you really need to accomplish removing that private information.

提交回复
热议问题