git 从获取中排除个别分支

git exclude individual branches from fetch

我的存储库 'origin' 有几个我不想在 git log --all 中看到的分支。如何从我的本地存储库中排除个别远程分支?

您可以使用 --not --remotes=,然后列出您要排除的分支。 例如: git log --all --not --remotes=origin/master, origin/HEAD 将只列出 origin/develop 的提交,没有 master 分支。

我发现这个可以解决我的问题:

git config --add remote.origin.fetch ^refs/heads/remove-branch-I-want-to-ignore