Switching a branch after aborting current changes in git

前端 未结 9 1385
情书的邮戳
情书的邮戳 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:06

    You can discard changes you made in a specific file:

    git checkout somefile.txt
    

    And then jump smoothly to the branch:

    git checkout gh-pages
    

提交回复
热议问题