Bo's Log 一寸欢喜

Remove history from github

2020-05-13
Bo Chen

In order to delete the history of the git commit and make it the branch new repo, please follow the steps below

  • Checkout the code to a new branch
    git checkout --orphan latest_branch

  • Stage the code
    git add -A

  • Commit the change
    git commit -am "commit message"

  • Delete the master branch
    git branch -D master

  • Rename the current branch to master
    git branch -m master

  • Push to remote branch
    git push -f origin master


Content