您的位置:首页 > 运维架构

清理旧的远程git分支 - cleaning up old remote git branches

2020-07-11 14:57 555 查看

钉钉、微博极速扩容黑科技,点击观看阿里云弹性计算年度发布会!>>>

问题:

Here is my git workflow. 这是我的git工作流程。

I work from two different computers (A and B) and store a common git remote in dropbox directory. 我在两台不同的计算机(A和B)上工作,并将一个通用的git remote存储在dropbox目录中。

Let's say I have two branches master and devel. 假设我有两个分支master和devel。 Both are tracking their remote counterparts origin/master and origin/devel. 两者都在跟踪其远程对方的原点/原点和原点/开发。

Now while on computer A, I delete branch devel - both local and remote - as follows: 现在,在计算机A上,我删除分支开发-本地和远程-如下:

git push origin :heads/devel

git branch -d devel

Now if I do git branch -a on computer A, I get 现在,如果我在计算机A上执行git branch -a ,我得到

master
origin/HEAD
origin/master

I now go to computer B. Do git fetch . 我现在转到计算机B。执行git fetch I can remove the local devel branch by 我可以通过删除本地devel分支

git branch -d devel

But I can't remove the remote devel branch. 但是我无法删除远程devel分支。

git push origin :heads/devel

error: unable to push to unqualified destination: heads/proxy3d
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we a
ff8
re unable to guess a prefix based on the source ref.
fatal: The remote end hung up unexpectedly

Doing git branch -a still lists origin/devel in remote branches. 进行git branch -a仍会列出远程分支中的起点/终点。

How can I clean up the remote entry of devel from machine B? 如何从机器B清理开发的远程入口?

解决方案:

参考一: https://stackoom.com/question/DMRn/清理旧的远程git分支
参考二: https://oldbug.net/q/DMRn/cleaning-up-old-remote-git-branches
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git dropbox