我有 develop 和 master 分支,我的 develop 分支现在很乱,我想重置它并将它作为我的 master 的副本,然后将它推送到服务器。
我不确定将 master merge 到 develop 是否会使它们完全相同。尝试后
git branch -f develop master
git checkout develop
我收到以下消息
Switched to branch 'develop' Your branch is behind 'origin/develop' by 34 commits, and can be fast-forwarded. (use "git pull" to update your local branch)
我也想更新 Remote ..我该怎么做?我该如何解决这一切
最佳答案
请注意,这将重写历史,并且任何其他使用原始开发分支的旧副本的人都需要以类似的方式进行更新。否则事情会变得非常草率。
# Delete your local develop
git checkout master
git branch -D develop
# Recreate your local develop, based on origin's master
git pull origin master
git checkout -b develop
# Push and overwrite the sloppy develop on the origin
git push origin develop --force
关于git - 如何将远程开发分支重置为 master,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23569739/