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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:53:56+00:00 2026-06-05T06:53:56+00:00

I am trying to extract (source code line, author label) pair from git repositories.

  • 0

I am trying to extract (source code line, author label) pair from git repositories. The easiest way to do that is using git blame. The problem is that git blame takes the last committer as the author no matter whether the committer just indents the code or really changes the code. Do you know any method to it better?

Or maybe before trying to solve the problem, I should first check how many source lines are associated with multiple authors. If the percentage is small, there is no need to worry about it. But I find even counting the number is difficult. For a commit with a single parent, how can we know that the commit changed a line rather deleted a line and added a lined? For a commit with two parents (like a merge), how should I combine the diff results from the two branch?

Thanks

  • 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-05T06:53:58+00:00Added an answer on June 5, 2026 at 6:53 am

    Overview

    This is a fundamental misunderstanding of how Git works. Git does not commit patches or diffs; it commits trees and blobs, although packfiles certainly do some sort of deltification. Most of the commit history is calculated at run-time with some flavor of diff.

    In other words, if your diff tools can do what you want, so can Git.

    git-blame

    The git-blame command won’t do what you want, because the man page says (emphasis mine):

    Annotates each line in the given file with information from the revision which last modified the line.

    In other words, it’s strictly line-oriented.

    git-log

    You can get close to what you want with git-log. For example:

    # Show diffs with indifference to whitespace changes (e.g. indenting).
    git log --patch --ignore-space-change
    
    # Just ignore whitespace altogether.
    git log --patch --ignore-all-space
    
    # Show deletions with [- -] and additions with {+ +}.
    git log --patch --word-diff=plain
    
    # Custom diff format where ~ denotes newlines.
    git log --patch --word-diff=porcelain
    

    The porcelain format is intended for text processing, but it’s very non-intuitive from a visual point of view. However, it is well-documented in man 1 git-diff for your programming pleasure.

    The downside is that you will have to get your author information from the GIT_AUTHOR_NAME or GIT_COMMITTER_NAME associated with each commit, rather than having Git decorate it for you.

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

Sidebar

Related Questions

I'm trying to make a PHP regex to extract functions from php source code.
I'm trying to extract functions and function headers from some source code files. Here's
I'm trying to extract the urls from a .htm source, that contains 3 other
im trying to extract some files from a jar-file downloaded using java-webstart. below code
I'm trying to parse a website's source to extract text inside using lxml library.
I'm trying to extract strings from a text that features two different types of
I'm trying to extract EXIF information from images using jQuery. I've tried using a
I am trying to process some PHP code to extract keys from a specific
I'm trying to extract text and HTML from a website with Scandinavian characters using
I am trying to extract a BitmapImage from a JPG. This is the 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.