3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Gitでマージ済みで不要となったブランチを削除するエイリアスを登録する

Last updated at Posted at 2022-02-17

開発を続けていると自分の機能ブランチ、レビューした他の人のブランチ、リリース作業用のブランチ…、とたくさんブランチが増えてきます。
よく忘れてしまうのでマージ済みのブランチを消すエイリアスのメモです。(エイリアスだけ残っていたのですが、おそらくコチラから頂いてきました)

develop/main/master を除外します。

~/.gitconfig
[alias]
    delete-merged-branch = "!f () { git checkout $1; git branch --merged|egrep -v '\\*|develop|main|master'|xargs git branch -d; };f"
$ git delete-merged-branch
Your branch is up to date with 'origin/develop'.
Deleted branch feature/...
Deleted branch feature/...
Deleted branch feature/...
Deleted branch feature/...
Deleted branch feature/...
Deleted branch feature/...
Deleted branch feature/...
Deleted branch feature/...
Deleted branch release/...

Screen Shot 2022-02-17 at 13.03.04.png

参考

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?