Resetting commit history by replacing main branch
From your terminal run:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Checkout from your main branch
git checkout --orphan latest_branch
# Add all the files
git add -A
# Commit your changes
git commit -am "commit message"
# Delete the original branch
git branch -D master
# Rename the current branch to master
git branch -m master
# Finally, force update your repository
git push -f origin master
And you are done.