在我目前的回购中,我有以下输出:
$ git branch -a
* master
remotes/origin/master
remotes/public/master
Run Code Online (Sandbox Code Playgroud)
我想remotes/public/master从分支列表中删除:
$ git branch -d remotes/public/master
error: branch 'remotes/public/master' not found.
Run Code Online (Sandbox Code Playgroud)
此外,输出git remote是奇怪的,因为它没有列出public:
$ git remote show
origin
Run Code Online (Sandbox Code Playgroud)
如何从分支列表中删除"remotes/public/master"?
更新,尝试了git push命令:
$ git push public :master
fatal: 'public' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud) 这是我的git工作流程.
我在两台不同的计算机(A和B)上工作,并在dropbox目录中存储一个公共git远程.
假设我有两个分支主人和开发人员.两者都在追踪他们的远程对手origin/master和origin/devel.
现在,在计算机A上,我删除了分支开发 - 本地和远程 - 如下所示:
git push origin :heads/devel
git branch -d devel
Run Code Online (Sandbox Code Playgroud)
现在如果我git branch -a在电脑A上做,我明白了
master
origin/HEAD
origin/master
Run Code Online (Sandbox Code Playgroud)
我现在去电脑B.做git fetch.我可以删除本地开发分支
git branch -d devel
Run Code Online (Sandbox Code Playgroud)
但我无法删除远程开发分支.
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 are unable to guess a prefix based on the source ref.
fatal: The remote end hung up unexpectedly …Run Code Online (Sandbox Code Playgroud) 如果有人删除了一个远程分支,因为工作结束了,我不知道,我不会做git fetch --prune,最终我会推回已删除的分支.
是否有可行的解决方案强制git在获取/拉取时使用剪枝模式而不必每次都指定它?
这可能是一个愚蠢的问题,但我是git的新手,我看到一个不再存在的远程分支.
$ git branch -a
* master
remotes/origin/master
remotes/origin/production
Run Code Online (Sandbox Code Playgroud)
我不相信生产分支存在远程,也无法弄清楚为什么它仍然在本地显示.如何删除/删除此分支?这是尝试删除它的样子:
$ git push origin :production
error: unable to push to unqualified destination: production
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@IP:puppet.git'
Run Code Online (Sandbox Code Playgroud)
我可以检查所谓的远程生产分支,但得到这个:
$ git checkout origin/production
Note: checking out 'origin/production'.
You are in 'detached HEAD' state. You can look around, make experimental …Run Code Online (Sandbox Code Playgroud) 我使用IntelliJ(2016.1.3)和GIT集成插件(8.1).在我使用IntelliJ期间,我检查了多个分支.现在这些分支从GIT中删除(在每次拉取请求之后我们删除它们).
从现在开始,我检出的每个分支都出现在我的GIT视图中,来自Intellij(由VCS> Git> Branches ...),见下:
有一种方法可以删除它们:一个接一个地做!但如果有很多分支(比方说一百......),它肯定会变得单调乏味......
问题是: 您是否知道在IntelliJ中是否有一种简单的方法可以从此视图中删除所有孤立本地分支?
谢谢 :)
编辑:我找到了一种方法来删除它们,但在另一个工具:"Git Gui".当您从那里删除它时,它也会在IntelliJ中删除.您可以一次删除多个分支.