Switching a branch after aborting current changes in git

前端 未结 9 1486
情书的邮戳
情书的邮戳 2021-01-30 17:00

I cloned a git repo and then started playing around in its master branch. After a while, I want to ignore the changes I just made (without committing them), and switch to a diff

9条回答
  •  野性不改
    2021-01-30 17:13

    Option 1

    git checkout -f gh-pages
    

    Option 2

    git reset --hard     # beware: don't make that a habit
    git checkout gh-pages
    

提交回复
热议问题