Last active
June 18, 2021 19:50
-
-
Save mikerodionov/a422dfbe2802fd544d05e552f13d5370 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Checkout repo which needs history clear up | |
# Assuming repo has default "main" name | |
git checkout --orphan latest_branch | |
# Once current state checked out to local folder add all files | |
git add -A | |
# Commit "the changes" | |
git commit -am "Repo clear up" | |
# Delete your original remote branch | |
git branch -D main | |
# Rename the current branch to main | |
git branch -m main | |
# Force update remote repository | |
git push -f origin main | |
# This will remove your old commit history |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment