There are lots of scripts floating around on the internet for deleting already-merged branches such as
$ git branch --merged master | grep -v master | xargs -n 1 git branch -d
but I'd like to keep my branches around for a while before doing the cleanup. So:
How can I find when a particular branch was merged? I'd like to be able to get the hash and the date of the merge commit. Extra credit for the ability to pipe several branches in. I'm ultimately going for
$ git branch --merged master | [find dates for each]
| [compare dates to arbitrary date] | [delete old merged branches]
I realize that the standard practice is to tag/delete branches that you want to keep around a little longer, but if I did that, I'd still be asking this question about the hash and time of the merge commit.
Edit:
I've been looking through these threads, because it strikes me that I'm looking for the child commit of the branch reference. Unfortunately, as mentioned in this comment, --children
only adds the children to the commits returned by a log
or rev-list
, instead of only returning children.