---
title: "刪除 Git 中已經 merge 的 branch"
description: "你可以在 egrep -v 'master|develop|foo|bar' 中放行更多 branch"
canonical: https://oozou.com/til/delete-already-merged-branchs-in-git-36
locale: zh-Hant
date: 2020-10-13
topic: shell
---

# 刪除 Git 中已經 merge 的 branch

> 你可以在 egrep -v 'master|develop|foo|bar' 中放行更多 branch

Published: 2020-10-13 · Topic: [shell](https://oozou.com/zh-Hant/til-topics/shell) ([markdown](https://oozou.com/zh-Hant/til-topics/shell.md))

```
$ git branch --merged | egrep -v 'master|develop' | xargs -n 1 git branch -d
```

你可以在 *egrep -v 'master|develop|foo|bar'* 中放行更多 branch

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/zh-Hant/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
