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

The Archive Base Latest Questions

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

Use case: I find a piece of code that I do not understand at

  • 0

Use case:

I find a piece of code that I do not understand at all. I want to find the temporal context in which this code was written, and all of the changes that this part of the code underwent.

Basically look up the history of this file but only the parts of that history which intersect with [lines 34 thru 38 (as an example)].

Is there a command for this that is more useable than git log -p <file> | grep <some snippet matching mysterious code> and then going back to the log -p output to look at the context in the diff there.

What’s sad is that I often find the need for this kind of functionality when reviewing code that I wrote.

  • 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-05T13:11:32+00:00Added an answer on June 5, 2026 at 1:11 pm

    git blame <path to file> will give you list of commits with context (changes done at at that commit point in that file). Read git help blame for all the powers it has.

    Then you can use git show <commit>:<path> to see the whole file at that commit point or git diff <commit> <commit> -- <path> to see the difference

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

Sidebar

Related Questions

This seems like a fairly straightforward question, but I couldn't find this particular use-case
My use case is as follows: I would like to find all occurrences of
I have this use case for which I am generating an image in the
which STL Algorithm should i use if I want to find something but Don't
use case is simple: I want to run some boiler plate code before each
Here's the use case: I have this long form with group of field that
Use case: My extension fails to find the window I want so it opens
Use case: I've just entered insert mode, and typed some text. Now I want
The use case is that I use one development machine for different source trees.
Use case example: Client A comes to request sales information, enters their zip code

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.