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 :
- Use
git log --merges
to get all merge commits - 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. - 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!