撤消 git 遥控器上的设置分支

Undo set-branches on git remote

我目前已经设置了我的 git 远程来限制获取哪些分支:

git remote set-branches myOrigin myBranch

这会将正确的条目添加到 .git/config:

[remote "myOrigin"]
    fetch = +refs/heads/myBranch:refs/remotes/myOrigin/myBranch

现在我想撤消这个,回到默认配置:

[remote "myOrigin"]
    fetch = +refs/heads/*:refs/remotes/myOrigin/*

如何在不手动修改 .git/config 的情况下执行此操作?有没有 git 命令我可以 运行?

解决方案之一:

git config remote.myOrigin.fetch +refs/heads/*:refs/remotes/myOrigin/*

只需使用引号:

git remote set-branches myOrigin '*'