I'm a beginner with Git. So here's the scenario, In an empty text file, I added One String and performed the following command:
git init
git add sample.txt
git commit -m "Added One"
git push origin master
Next, I added Two on the next line and performed the following command:
git add sample.txt
git commit -m "Added Two"
git push origin master
And ended up until Three making it contain:
One
Two
Three
Then I performed git reset --hard 'value of the first commit here' to bring back the file which contains One and added Four making it:
One
Four
So when I performed a commit and push, the following error showed:
Updates were rejected because the tip of your current branch is behind its remote counterpart.
How can I push my commit rejecting the other 2 commits so that the final text file will contain:
One
Four