Using git log to find branch creation dates in a repository

Viewed 239

I’m trying to use the git history to find out when branches in a repository were created. I’m approximating a branch’s creation date as the date of the first commit on a branch. The repositories I’m dealing with have no activity in the list 90 days, so the Github API doesn’t store this information.

My current approach is :

  1. Use git log --merges to get all merge commits
  2. For each merge commit with parents A and B, use git merge-base A B to find the most recent common ancestor between those 2 commits. This is commit C.
  3. Use git log B..C to list all commits on the branch, and use the last commit’s commit date as an approximation date for when the branch was created.

I wanted to see if anyone knew of a more concise way to do this besides my approach above.

Thanks!

0 Answers
Related