3
1

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 5 years have passed since last update.

Gitで全てのブランチから最終コミット日時とユーザーを確認する方法

Posted at

経緯

リポジトリのメンテナンスとして不要なリモートブランチを削除する必要があり、自分が消し忘れたまま放置してしまっている物が無いかを確認したかった。

方法

下記コマンドで確認出来た。

コマンド

$ git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | grep [ユーザー名]

実行例

Tue Feb 27 18:10:29 2018 +0900   ore         refs/heads/hoge
Thu Mar 8 11:00:40 2018 +0900    ore         refs/heads/fuga
Mon Feb 19 11:11:53 2018 +0900   ore         refs/remotes/origin/foo
Thu Feb 8 16:41:01 2018 +0900    ore         refs/remotes/origin/bar
Fri Mar 16 15:44:42 2018 +0900   ore         refs/stash

雑記

for-each-refというコマンドの存在自体を今まで知らなかった。
--formatには他にもsubject等が指定出来るようなので、全ブランチから横断で何かを探したい場合には便利かもしれない。

3
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?