How to discard all changes made to a branch?

后端 未结 9 1313
粉色の甜心
粉色の甜心 2021-01-29 18:03

I\'m working in a branch (i.e. design) and I\'ve made a number of changes, but I need to discard them all and reset it to match the repository version. I thought

9条回答
  •  梦毁少年i
    2021-01-29 18:38

    When you want to discard changes in your local branch, you can stash these changes using git stash command.

    git stash save "some_name"

    Your changes will be saved and you can retrieve those later,if you want or you can delete it. After doing this, your branch will not have any uncommitted code and you can pull the latest code from your main branch using git pull.

提交回复
热议问题