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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:47:20+00:00 2026-05-25T14:47:20+00:00

I have a file from a project that uses GIT as repository. For that

  • 0

I have a file from a project that uses GIT as repository. For that file I need to find out to which revision this file belongs to. The file is stand-alone outside of an repository (not tracked) therefore the standard git commands do not work.

Is there a way to determine the revision this file belongs to only based on its filename and its content?

  • 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-25T14:47:20+00:00Added an answer on May 25, 2026 at 2:47 pm

    I don’t think there’s a one-shot command to do this – git’s object model makes it quite laborious to work back from a blob to commits that might reference it. Here’s one way of doing it, though. First of all, find the hash of the file that git would use, with:

    git hash-object foo.c
    

    Suppose that returns f414f31. Then you can use a script like the following:

    for c in $(git rev-list --all)
    do
       ( git ls-tree -r $c | grep f414f31 ) && echo Found the blob in commit: $c
    done
    

    … to show all the commits that contain that blob. If you want to know which branches those commits are on, you can do:

    git branch -a --contains 1a2b3c4d
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have bat-file, that make some operations. How to run this file from Delphi
I have a Visual Studio project that uses a solution file to build it.
We have an application that stores project information in a file by descending from
I'm setting up a project that uses SASS, which uses FSEvents to keep from
I have a project that uses an asmx file with [WebMethods] and [SoapHeader(Auth)]. I
I have a project that I'm working that uses XSLT to display data from
I have an older project that uses the sun.net.ftp.FtpClient class to download a file
I have got this project that uses excel for some calculation. This excel is
I have a 2.4 MB XML file, an export from Microsoft Project (hey I'm
I have a project containing files generated from a .g file (antlr 2.7.x). The

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.