Switching a branch after aborting current changes in git

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

    If you're really sure that you want to throw away your uncommitted changes (i.e. those that are staged as well as those in your working tree) you can do:

    git reset --hard
    

    In general, stashing is often safer

提交回复
热议问题