有很多类似的问题(例如这个或这个),但被接受的答案似乎不能回答我的确切问题。
Branch1未合并到master。机器A和机器B都指向同一个远程。Branch1存在于该远程。
在机器A上,我本地删除了Branch1并将其推送到远程,以便从Machine A和远程中删除Branch1和remotes/origin/Branch1。
在机器B上,我运行以下操作:
git checkout Branch1
,然后git checkout Branch2
,然后git fetch --prune
git fetch --prune
会从我的本地仓库中删除remotes/origin/Branch1。如果我通过运行git checkout Branch1
返回Branch1,则会收到以下错误消息:
Switched to branch 'Branch1'
Your branch is based on 'origin/Branch1', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
是否有一个git命令可以删除具有已删除上游的本地分支?