Home > other >  Removing commmits from github repo history
Removing commmits from github repo history

Time:01-22

I have a github repo shared with two people, have recently worked on the project and made commits (also pushed to the repo). Is it possible for me to remove the commits i made so that the others with acces to the repo have no acces to my progress anymore?

CodePudding user response:

Deleting the .git folder may cause problems in your git repository. If you want to delete all your commit history but keep the code in its current state

Checkout

git checkout --orphan latest_branch

Add all the files

git add -A

Commit the changes

git commit -am "commit message"

Delete the branch

git branch -D main

Rename the current branch to main

git branch -m main

Finally, force update your repository

git push -f origin main
  • Related