Checkout to main branch
git checkout --orphan latest_branch
Add all the files from main branch
git add -A
Commit the changes
git commit -am "Initial commit"
Delete the main branch
git branch -D main
Rename the current branch to main
git branch -m main
Force update your GitHub repository
git push -f origin main
Top comments (1)
Or just one-liner: rm -r .git; git init; git add . && git commit -m "IC"; git push :)