I am a git newbie, I am trying to understand to undo changes in git. Say I have two branches
1: master
2: work
I am working in work branch and I want to pull the latest changes from my teammates in work branch, so I am supposed to give the command
git pull origin work
But instead, I gave the command
git pull origin master
It fetches a bunch of commits from master branch.Now, I want to undo the last pull(assuming no local uncommited changes), will this command be sufficient
git reset --hard HEAD~1
Will the above command accomplish undoing git pull? Is there any scenario where it might not work?
Edit
After reading the answers, Do HEAD~1 and ORIG-HEAD refer to the same commit after a pull/merge?