Will & Skill Developers

Will & Skill Developers


Thoughts, snippets and ideas from the team at Will & Skill AB, Stockholm.

Faisal M
Author

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

Share


Tags


avrt

Deleting your git commit history without removing repo on Github/Bitbucket

When you have just found out that you or a fellow team mate has committed sensitive data into your Github repo. What do you do? If you do not have hundreds of c…

Faisal MFaisal M

When you have just found out that you or a fellow team mate has committed sensitive data into your Github repo. What do you do?

If you do not have hundreds of commits already. You can follow the steps mentioned below.

WARNING: This should be used with care! It also removes the configuration of the repo.

Step 1###

Remove all history

$ cd myrepo
$ rm -rf .git

Step 2###

Init a new repo

$ git init
$ git add .
$ git commit -m "Removed history, due to sensitive data"

Step 3###

Push to remote

$ git remote add origin github.com:yourhandle/yourrepo.git
$ git push -u --force origin master

Source: StackOverflow

Faisal M
Author

Faisal M

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

View Comments