Reset local repository branch to be just like remote repository HEAD

后端 未结 21 1585
挽巷
挽巷 2020-11-22 02:19

How do I reset my local branch to be just like the branch on the remote repository?

I did:

git reset --hard HEAD

But when I run a <

21条回答
  •  礼貌的吻别
    2020-11-22 03:02

    I needed to do (the solution in the accepted answer):

    git fetch origin
    git reset --hard origin/master
    

    Followed by:

    git clean -f
    

    to remove local files

    To see what files will be removed (without actually removing them):

    git clean -n -f
    

提交回复
热议问题