git discard all changes and pull from upstream

前端 未结 5 1091
迷失自我
迷失自我 2021-01-29 17:59

How do I fetch upstream repo and make it replace master? I only have one branch on my repo, which is master, and I completely messed it up, so I basically need to start over fro

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-29 18:37

    You can do it in a single command:

    git fetch --all && git reset --hard origin/master
    

    Or in a pair of commands:

    git fetch --all
    git reset --hard origin/master
    

    Note than you will lose ALL your local changes

提交回复
热议问题