Reset local repository branch to be just like remote repository HEAD

后端 未结 21 2019
挽巷
挽巷 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:10

    Have you forgotten to create a feature-branch and have committed directly on master by mistake?

    You can create the feature branch now and set master back without affecting the worktree (local filesystem) to avoid triggering builds, tests and trouble with file-locks:

    git checkout -b feature-branch
    git branch -f master origin/master
    

提交回复
热议问题