Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

How to remove git commit history

junwufan edited this page Apr 19, 2023 · 2 revisions

How to remove git commit history

  • git checkout --orphan latest_branch
  • git add -A
  • git commit -am "Initial commit message" #Committing the changes
  • git branch -D master #Deleting master branch
  • git branch -m master #renaming branch as master
  • git push -f origin master #pushes to master branch
  • git gc --aggressive --prune=all # remove the old files

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.