Git 如何强制执行分支更新?
这是一个关于git分支和git pull的问题 目前的情况如下Git 如何强制执行分支更新?,git,github,Git,Github,这是一个关于git分支和git pull的问题 目前的情况如下 已在远程存储库中创建了“发布”分支。 (远程) 在本地拉“释放”分支。 (本地) 已从远程存储库中删除“发布”分支。 本地仍然有一个“release”分支。 (远程) 已在远程存储库中创建了一个具有新功能的“发布”分支。 (远程) 我希望本地“release”分支在远程存储库中更新为新的“release”分支。 (本地) git pull不起作用,因为分支名称相同,但创建的分支不同 什么是好办法 请给我一些建议。如果您删除了您的本地
请给我一些建议。如果您删除了您的本地分支,然后重新创建,这将为您提供帮助。例如:
git checkout master
git branch -D releaseBranch
git checkout -b releaseBranch
如果您删除本地分支,然后再次创建它,这将为您做到这一点。例如:
git checkout master
git branch -D releaseBranch
git checkout -b releaseBranch
只需将远程发布分支获取到本地发布分支。
git签出主机
git fetch:
git checkout
只需将远程发布分支拿到本地发布分支即可。
git签出主机
git fetch:
git签出
可以通过两个步骤完成:
git fetch the-remote # fetch information about the position of branches/tags on the remote
git branch -f release the-remote/release # set the position of local release to whatever point the-remote/release is at... no merging/rebasing involved
可分两步完成:
git fetch the-remote # fetch information about the position of branches/tags on the remote
git branch -f release the-remote/release # set the position of local release to whatever point the-remote/release is at... no merging/rebasing involved
嗯,如果您没有任何要保留的本地更改,您可以重新设置
git reset --hard origin/releaseBranch
嗯,如果您没有任何要保留的本地更改,您可以重新设置
git reset --hard origin/releaseBranch