git: discard local changes








  • To discard all local uncommitted changes:
    git reset --hard
    which is equivalent to:
    git reset --hard HEAD
  • To discard the latest local commit(move HEAD back by one commit):
    git reset --hard HEAD^
    or move HEAD by 3 commits:
    git reset --hard HEAD~3



No comments:

Post a Comment