text 删除已合并到“develop”分支中的所有远程/本地分支

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 删除已合并到“develop”分支中的所有远程/本地分支相关的知识,希望对你有一定的参考价值。

# Delete "remote merged branches" explaination;
#
# git branch -r --merged develop  List all remote (with flag '-r' --> 'r' stands for 'remote') branches that have been merged into the 'develop' branch
# grep -vE "development|master"   Remove 'develop' and 'master' from the search results as we don't want to delete this branches
# cut -d"/" -f2-                  Remove everything before the first '/' (this the 'remote' part which we don't need)
# xargs git push --delete origin  Run a remote 'delete branch' command for every found result (assuming the remote is named 'origin')

# remote delete
$ git branch -r --merged develop | grep -vE "develop|master" | cut -d '/' -f2- | xargs git push --delete origin


# Additonal delete "local merged branches" explaination;
#
# cut -d ' ' -f2-       Remove everything before the first '/' (this the 'remote' part which we don't need)
# xargs git branch -d   Run a local 'delete branch' command for every found result


# local delete
$ git branch --merged develop | grep -vE "develop|master" | cut -d ' ' -f2- | xargs git branch -d

以上是关于text 删除已合并到“develop”分支中的所有远程/本地分支的主要内容,如果未能解决你的问题,请参考以下文章

合并分支,从当地分支机构挑选樱桃,没有任何冲突

git 如何把develop分支代码合并到master主分支

如何用git从develop分支拉最新代码至本地

git合并分支

github

Git版本管理规范(Git Flow)