Permanently remove one old commit in Git

About two months ago, one of my employees added their virtual environments to our Git repository and clicked it.

I deleted it in a subsequent commit / push and added it to .gitignore.

However, since then we have had about 500 more commits.

Is there a way by which I can simply delete my original 90k transaction as a whole from Github and our local repositories without causing any problems?

+4
source share
2 answers

You can create a branch from commit to problem, and a branch on the first commit after problem. Then rearrange the second to the first. Then, if you reset your wizard, point to the new tip of this branch and delete all links to another line, GC will eventually destroy the elements.

Of course, you probably want to re-clone the entire repo after this, since it is such an invasive change that involves updating a large number of links (assuming that there was a lot of things that happened on the repo from your description, as it is).

+3
source

Github has a help page to delete sensitive data that also applies to your situation (there are only a few parts specific to Github that you can ignore).

The good news is removing the old commit.

The bad news is that you can cause problems with your employees if you cannot communicate effectively so that the whole history of the repository changes. They will need to reinstall all their work branches against the new story.

+3
source

Source: https://habr.com/ru/post/1445625/


All Articles