清理远程Git分支
我已经将SVN回购协议转移到Git,可能是由于一些结案,我现在剩下的分支看起来像清理远程Git分支,git,git-branch,git-remote,Git,Git Branch,Git Remote,我已经将SVN回购协议转移到Git,可能是由于一些结案,我现在剩下的分支看起来像 BranchA origin/BranchA remotes/BranchA remotes/origin/BranchA remotes/origin/origin/BranchA i、 e.同一分支被多次列出。我怎样才能把这乱七八糟的东西收拾干净。有超过50个分支,有些根本不需要,剩下的我很乐意只需要一次 编辑: 这就是git remote show origin在特定情况下的外观: Remote branc
BranchA
origin/BranchA
remotes/BranchA
remotes/origin/BranchA
remotes/origin/origin/BranchA
i、 e.同一分支被多次列出。我怎样才能把这乱七八糟的东西收拾干净。有超过50个分支,有些根本不需要,剩下的我很乐意只需要一次
编辑:
这就是git remote show origin在特定情况下的外观:
Remote branches:
BranchA tracked
origin/BranchA tracked
可以使用以下命令删除这些分支:
git push origin :branch_name
要删除分支
分支:
git push origin :BranchA
git push origin :origin/BranchA
要删除origin/BranchA
分支:
git push origin :BranchA
git push origin :origin/BranchA
或者,您可以使用git branch-dr BranchA
等等
删除除
BranchA
和origin/BranchA
之外的所有分支。您可能已经删除了源站
遥控器,在这种情况下,您应该删除遥控器
遥控器,并将其重新添加为源站
遥控器。我应该删除哪些?假设我想保留一个BranchA,它是remotes/BranchA吗?git rm在文件上工作,而不是在分支上工作(既不是本地跟踪也不是“远程跟踪”)。这些参数的语法似乎表明您打算编写关于使用git push从远程存储库中删除分支的内容。OP也有一些本地和“远程跟踪”分支需要删除(git branch-d
以及git branch-dr
或git remote prune
)。@Chris Johnsen:没错,我应该使用git push
或git branch-dr
)。我现在将更新答案以反映这一点。