Skip to content

Instantly share code, notes, and snippets.

@CarloCattano
Last active October 23, 2022 13:55
Show Gist options
  • Save CarloCattano/0dc30f3c80e2c070a3923a07a5b3cfde to your computer and use it in GitHub Desktop.
Save CarloCattano/0dc30f3c80e2c070a3923a07a5b3cfde to your computer and use it in GitHub Desktop.

Reset commit history

git add -A
git commit -am "Initial commit"
git branch -D main
git branch -m main
git push -f origin main

Push to new fork

git remote add my-fork https://github.com/yourName/YourForkName
git fetch my-fork
git push my-fork 

Set commit hash to HEAD

git checkout <branch-to-modify-head>
git reset --hard <commit-hash-id-to-put-as-head>
git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment