Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7400607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:16:26+00:00 2026-05-29T04:16:26+00:00

In an attempt to gather some statistics about a Git repository, I’m looking for

  • 0

In an attempt to gather some statistics about a Git repository, I’m looking for a way to do the following:

  • For each commit, execute a command (ex; du -h).
  • That command should run from the repository base directory “as it looked like” after the commit.
  • The command would ideally have access to the commit hash and time stamp.

One application, expressed in quasi-Bash, would be to run

echo $HASH $TIME `du -hs --exclude=".git" . | awk '{ print $1; }'` >> ../sizeovertime

on all commits to get an idea of the growth of the repository.

(Somehow, it feels like it should be possible to use git filter-branch --tree-filter for this but that looks like a terrible hack to me.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:16:27+00:00Added an answer on May 29, 2026 at 4:16 am

    I don’t see how you could do this without checking out each commit, so that is going to take a while on a large repository.

    Here’s how you could go about it with bash:

    #! /bin/bash
    
    while read co dt ; do
        git checkout $co > /dev/null 2>&1
        size=$(du -hs --exclude=.git|cut -f1)
        echo $co $size $dt
    done < <(git rev-list --pretty=format:"%H %ci" --all --date-order |grep -v "^commit")
    

    Warning: this will leave you in detached head state, on the oldest commit, which is not a nice place to be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempt to generalize my questions... I want to execute a stored procedure for each
Clone attempt over ssh: Cloning into repo... Password: bash: git-upload-pack: command not found fatal:
In an attempt to add some parameter validation and correct usage semantics to our
In an attempt to wrap some unmanaged code in a managed .dll I'm trying
In my attempt to learn core JavaScript, I am now learning about EventListeners. My
here is the website im talking about http://makeupbyarpi.com/portfolio.php you'll notice some of the images
First attempt at a RoR project and following http://guides.rubyonrails.org/getting_started.html#creating-the-blog-application . I've got the Welcome
First attempt to use this cool site - after searching for 2 hours: So
If I attempt to connect to Mac OS X 10.5 Leopard's built in vnc
When you attempt to declare an unsigned variable in C#.NET with a value outside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.