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 8066427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:59:30+00:00 2026-06-05T11:59:30+00:00

I want to see the date of git creation (date of first commit where

  • 0

I want to see the date of git creation (date of first commit where they were added) of all the files on a specified directory.

  • 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-06-05T11:59:32+00:00Added an answer on June 5, 2026 at 11:59 am

    I’ll break my solution into steps.

    Get a list of all files in the repository

    $ git ls-files
    

    This returns a list of relative paths of all files in the repository.

    Get the SHA-1 of the first commit of a given file:

    $ git rev-list HEAD <file> | tail -n 1
    

    This will return a list of all parentless commits for a given file, in reverse chronological order. The last one is the SHA-1 hash of the first commit for the given file.

    You can verify this by running git log --raw <hash>. You should see something like:

    commit <commit_hash>
    Author: Susy Q <suzy@example.com>
    Date:   Wed Aug 24 12:36:34 2011 -0400
    
        Add new module 'example.py'
    
    :000000 100644 0000000... <hash>... A  example.py
    

    Show the date of a given commit

    $ git show -s --format="%ci" <hash>
    

    Bringing it all together in a bash script:

    #!/bin/bash
    for file in $(git ls-files)
    do
        HASH=$(git rev-list HEAD "$file" | tail -n 1)
        DATE=$(git show -s --format="%ci" $HASH --)
        printf "%-35s %s\n  %s\n" "$file" $HASH: "$DATE"
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to query the server to see if the date is different than
I want to see a list of all changes the next push would do.
I want to see how my #include files be processed when Microsoft Visual Studio
I want to see all commands while building/releasing on the output window. When I
I want to see if a lock file modify date is more than a
Suppose I have a date like 01/01/2012 and I want to see what day
Although I am sure that I've added& committed ALL files and folders into my
I just want to format current date into yyyymmdd in DB2. I see the
I want to see all users which following me or another user. I have
I want see the source code of System.Web.Routing.RouteValueDictionary class. But Reflector can't disassemble it

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.