Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git清理旧分支_Git_Git Bash - Fatal编程技术网

git清理旧分支

git清理旧分支,git,git-bash,Git,Git Bash,我想创建一个git命令,该命令将删除当前分支中包含所有提交的所有分支,例如 $ git branch groups * master $ git cleanup-branches deleted groups # all commits are included in master $ git branch * master 我该如何创建它?您可以在这里利用git branch-d,因为它不会删除任何尚未合并到当前分支中的分支: git config --global alias.cl

我想创建一个git命令,该命令将删除当前分支中包含所有提交的所有分支,例如

$ git branch
  groups
* master

$ git cleanup-branches
deleted groups # all commits are included in master

$ git branch
* master

我该如何创建它?

您可以在这里利用
git branch-d
,因为它不会删除任何尚未合并到当前分支中的分支:

git config --global alias.cleanup-branches \
'!git branch | grep -v "\*" | awk "{ print $1 }" | xargs git branch -d'

刚在本地试用过,效果不错,尽管看着它工作有点可怕。

找到分支的答案是:哈!是的,这是一种方法,尝试删除所有内容!尽管如此,这似乎确实是一种可靠的方法。