How to revert to origin's master branch's version of file

前端 未结 3 1109
醉酒成梦
醉酒成梦 2021-01-29 17:00

I\'m in my local computer\'s master branch of a cloned master-branch of a repo from a remote server.

I updated a file, and I want to revert back to the original version

3条回答
  •  迷失自我
    2021-01-29 17:34

    If you didn't commit it to the master branch yet, its easy:

    • get off the master branch (like git checkout -b oops/fluke/dang)
    • commit your changes there (like git add -u; git commit;)
    • go back the master branch (like git checkout master)

    Your changes will be saved in branch oops/fluke/dang; master will be as it was.

提交回复
热议问题