Git: How to remove files that are now in gitignore but were added to repo before

前端 未结 2 883
温柔的废话
温柔的废话 2021-01-18 09:46

I have a couple of files that are in the repo and also in .gitignore.

I would like these files to be removed from the repo but not be deleted from my production ser

2条回答
  •  天命终不由人
    2021-01-18 10:47

    You need git filter-branch first, then ask everybody to rebase branches created off of your old history.

    Refer to: https://help.github.com/articles/remove-sensitive-data/

    This is complex, and might cause issue, so next time be careful so not to get there.

    If you can't do that due to some reason, then need to wait until time machine invented :)

提交回复
热议问题