相关疑难解决方法(0)

清理旧的远程git分支机构

这是我的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 git-branch

646
推荐指数
7
解决办法
30万
查看次数

git delete remotes:远程引用不存在

简而言之;

  • 如何删除远程多个合并的遥控器?

更多背景;

我有一个git repo,有几十个遥控器已经合并成了主人.我可以使用以下方法一次删除这些遥控器:

git push --delete origin myBranch-1234
Run Code Online (Sandbox Code Playgroud)

然而,对于所有遥控器来说,这是一个缓慢而乏味的过程.所以我正在尝试这个命令:

git branch -r --merged | grep origin | grep -v master | xargs git push origin --delete
Run Code Online (Sandbox Code Playgroud)

git branch -r --merged列出所有合并的遥控器.
grep origin告诉命令包含原点.
grep -v master告诉命令排除master.
xargs git push origin --delete告诉命令删除遥控器列表.

总之,我希望这会收集所有合并的遥控器并删除它们.

当我运行上面的命令时,我会收到每个合并的遥控器的以下内容;

error: unable to delete 'origin/myBranch-1234': remote ref does not exist
error: unable to delete 'origin/myBranch-1235': remote ref does not exist
error: unable to delete 'origin/myBranch-1236': remote ref does not exist
error: unable …
Run Code Online (Sandbox Code Playgroud)

git git-remote

100
推荐指数
3
解决办法
4万
查看次数

推送大型github仓库失败,"无法推送到不合格的目的地:主人"

我有一个大的git repo(从SVN repo创建),我想将它推送到github.鉴于它很大,我不能只是尝试直接推送它,因为它失败了"包太大"的错误.

到目前为止一切都很好,我可以一次推回一个回购.但是当我尝试这样做时会发生什么:

git push origin 86c310d8a680d6d0e052fa7db89adb25348f3e54:master
error: unable to push to unqualified destination: master
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.
Run Code Online (Sandbox Code Playgroud)

所以,远程仓库中还没有主分支,但我正试图推动它并且它失败了.

我该如何解决?或者我如何在遥控器上创建一个空的主分支,以便我可以推送它?

git github

62
推荐指数
1
解决办法
3万
查看次数

标签 统计

git ×3

git-branch ×1

git-remote ×1

github ×1