Git Custom User Counting

We use TFS 2013 and have 90 separate repositories next to them, with 40 developers regularly moving to and from these repositories.

I would like to write some statistics on the number of commits per user for a certain period in all projects. Is it possible to do this? Are there any open source projects that can do this? How about using some TFS libraries? I wish you didn't have to check out each of the repos to get the information.

+3


source to share


3 answers


If you want to fetch this information directly from the TFS server instead of pulling each repository one at a time, you can. To do this though, you need to query the TFS database directly, and you can easily write an SSRS report to make this information easy to consume.

Here is a query you can use to get started. This will show all commits in all repositories.



use [Tfs_DefaultCollection]

select r.Name, u.FullName, m.CommitTime, m.Comment 
from dbo.tbl_GitCommitMetadata m
left join dbo.tbl_GitCommit c on c.InternalCommitId = m.InternalCommitId
left join dbo.tbl_GitRepository r on r.InternalRepositoryId = c.InternalRepositoryId
left join dbo.tbl_GitCommitUser u on u.InternalId = m.CommitterId and u.PartitionId = m.PartitionId
order by r.Name, u.FullName, m.CommitTime

      

For reference, I have a little more information on how TFS stores git repos on my blog.

+3


source


Take a look at GitStats .



GitStats is a git repository statistics generator. It crawls the repository and outputs a html page with statistics.

0


source


You can get a list of users who have made some changes to the repository after the specified date using the following command:

git log --branches --remotes --after 2014-11-13 --format='%aN' | sort -u

      

If you have a list of users. You can get statistics for a given user using the command

git log --shortstat --branches --remotes --author="John Doe" --after 2014-11-01

      

I created a simple ruby ​​script that will generate statistics for all users who have made some changes to the repository over a given period of time:

https://gist.github.com/kallak/1b9be6c7c7f5283b557f

      

Run the script from the git repository folder.

To get a list of users and a summary of the changes they made between 2014-11-01 and 2014-11-13

git_stats.rb -a 2014-11-01 -b 2014-11-13

      

0


source







All Articles