I'm a not a git expert so this might look like a silly question.
I have local and remote repositories, I want to sync my local with the remote repository. I have many local changes, stashed changes, and few commits which are not yet pushed to remote.
One way can be to remove all local changes(using git clean
), revert commits and than fetch/pull
from remote. But I think there must be some single command which can do all this in one go. I tried using git reset --hard HEAD
and then git pull
but that gave me:
# Your branch and 'origin/master' have diverged,
# and have 1 and 9 different commits each, respectively.
Was looking at this question as well, but didn't help.