Search code examples
gitgithubgithub-apigoogle-bigquery

How to find commit of first release in Git repository


I am trying to analyze influences, e.g. commit rate, on the duration until the first release of a software repositories on github.

I found out that using the Github API is not a good idea as most of the repository do not use this functionality of github.

My second idea was to use the information in tags, but it seems that tags are not named consistently through different repositories, e.g. you could have following tags:

  • v1.0
  • v.1.0.1
  • Release 1.0
  • Release 1.0.1
  • 1.0
  • 1.0.1
  • 1.0.0.10
  • etc.

Of course I could use regular expression to filter out relevant tags, but I wonder if there is a more convinient way to get releases, especially the first release of a repository.


Solution

  • There has to be a better way. Paging @torek

    for x in `git tag`; do
      TAG=`git log -n1 --pretty="%cd %h" --date=iso refs/tags/$x`
      LIST=`echo -e "${TAG}\n${LIST}"
    done
    echo "${LIST}" | sort -M --reverse | uniq | tail -n1 | awk '{print $4}'| xargs git describe --tags