git discard all changes and pull from upstream

前端 未结 5 1138
迷失自我
迷失自我 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条回答
  •  旧时难觅i
    2021-01-29 18:34

    while on branch master: git reset --hard origin/master

    then do some clean up with git gc (more about this in the man pages)

    Update: You will also probably need to do a git fetch origin (or git fetch origin master if you only want that branch); it should not matter if you do this before or after the reset. (Thanks @eric-walker)

提交回复
热议问题