git discard all changes and pull from upstream

前端 未结 5 1090
迷失自我
迷失自我 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:44

    git reset   # you need to know the last good hash, so you can remove all your local commits
    
    git fetch upstream
    git checkout master
    git merge upstream/master
    git push origin master -f
    

    voila, now your fork is back to same as upstream.

提交回复
热议问题