~/hello-world
repo before doing some more serious things on another repo of mine...So, I have a repo with 2 branches. I want my master branch to remain virgin, without any commit except the initial one. Being perfectionist, i don't want to just revert to the initial files while keeping a messy, 3 commits log. So i did this:
Code: Select all
git reset --hard HEAD~2
~/hello-world
working directory, i only have the files i had on the initial commit. And... when i look at the git log
, now i only have my initial commit showing there. My bad history got erased. That is exactly what i wanted. Just a pure 2X "undo", going 2 commits behind.OK, now here is the problem. I tried a simple
git push
to push this to GitHub. But i get this error message:Code: Select all
error: failed to push some refs to 'https://SebastJava@github.com/SebastJava/hello-world.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
git reset --hard HEAD~2
on GitHub.