我有很多Git分支.如何删除已合并的分支?是否有一种简单的方法可以删除它们而不是逐个删除它们?
我已经开始玩Git并遇到过"上游"和"下游"这两个词.我之前见过这些,但从未完全理解它们.这些术语在SCM(软件配置管理工具)和源代码的上下文中意味着什么?
我可以这样说:
git push --all origin
Run Code Online (Sandbox Code Playgroud)
它会将所有分支推向原点.但如果我这样做:
git pull --all origin
Run Code Online (Sandbox Code Playgroud)
然后它不会从原点拉出所有分支,它只返回一个错误:
fatal: fetch --all does not take a repository argument
Run Code Online (Sandbox Code Playgroud)
好的,我这样做:
git pull --all
Run Code Online (Sandbox Code Playgroud)
买还是说:
You asked to pull from the remote '--all', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
Run Code Online (Sandbox Code Playgroud)
那么如何从原点拉出所有分支(就像我将所有分支推送到原点git push --all origin)?
当我表演时branch -a:
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/hello
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
然后我删除了分支:
$ git branch -r -D origin/hello
Deleted remote branch origin/hello (was c0cbfd0).
Run Code Online (Sandbox Code Playgroud)
现在我明白了:
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
分支"你好"已被删除.但是当我拿到:
$ git fetch
From localhost:project
* [new hello] hello -> origin/hello
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/hello
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
我很困惑.
我认为它已被删除,但它仍然存在.