Questions tagged [git-blame]

git-blame is a git command that shows what revision and author last modified each line of a file.

git-blame is a git command that shows what revision and author last modified each line of a file.

https://www.kernel.org/pub/software/scm/git/docs/git-blame.html

git annotate is almost an alias for git blame (the output format is slightly different).

115 questions
3
votes
2 answers

How to get source line numbers in a specific revision of a file?

It's possible to see source/original line numbers of lines with git blame But it shows line numbers according to the last commit that made a modification in the line I want to do the same for a specific commit/revision of a file. Example, File:…
user3790180
  • 433
  • 5
  • 12
3
votes
3 answers

git annotate a squashed commit

I've always been sceptical about 'squashing' or rewriting history, and now I'm just about convinced that I should ban this practice from the repos I manage. But maybe somebody can answer this, and save the day for my squash-championing colleagues. I…
Michael Scheper
  • 6,514
  • 7
  • 63
  • 76
3
votes
0 answers

Visual Studio Blame/Annotation to same view

While using Eclipse and IntelliJ for Java development I got used to seeing the annotation lines in edit mode right next to the changes I'm working on. Well, apparently Visual Studio always opens the annotations to a separate uneditable window. So…
Jeffed
  • 163
  • 2
  • 11
3
votes
1 answer

Convince git blame that one branch is more relevant to history than another

I like to use git blame as a secondary form of documentation. It's really useful to check why a commit was made, and when and by whom. But sometimes the history of a particular line gets lost. Some situations where this might happen: A change is…
joeytwiddle
  • 29,306
  • 13
  • 121
  • 110
3
votes
1 answer

How to copy lines by preserving authors

I have a file with a lot of lines and want to refactor it, by splitting it across multiple files. By simply copy/pasting I will loose history of committed lines and their authors when git blameing. Is there any way to copy/paste those lines and…
Engineer
  • 47,849
  • 12
  • 88
  • 91
3
votes
1 answer

How to find the previous authors of all changed lines in git?

Given a range of commits, say HEAD~1 and HEAD (i.e., just HEAD), I want to find previous authors of the lines that were changed in that range and how many lines they changed. More precisely: for each line that was changed in the range, I want to get…
gexicide
  • 38,535
  • 21
  • 92
  • 152
3
votes
3 answers

Cannot Git Blame files

I use Xcode and this repo on two separate laptops. On one laptop, in Xcode I can select the version editor pane and it shows me blame information on each line such as who made the commit and when. However, on the other laptop I always get the…
Alex Bollbach
  • 4,370
  • 9
  • 32
  • 80
3
votes
2 answers

git blame deleted file, automatically

It is a common question how to run git blame on a file which has earlier been deleted (with git rm). If you just run it with the old filename then it gives the same error as for a file which has never existed: % git init % echo 1 >a % git add a %…
Ed Avis
  • 1,350
  • 17
  • 36
3
votes
1 answer

git blame - fatal: bad revision '22'

According to this page (http://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git ) I should use a comma between line numbers when using git blame. However, if I try it out on my Windows machine using Powershell: git blame -L 12,22
Snowcrash
  • 80,579
  • 89
  • 266
  • 376
3
votes
0 answers

how do i fix broken Xcode 'git blame' / 'git log' panel?

for a while, i've been happy to have the capability in Xcode to use git log & git blame in the comparison panel. at some point in the recent past, this panel has stopped showing anything. in 'blame' mode, the panel is blank and the same color as my…
john.k.doe
  • 7,533
  • 2
  • 37
  • 64
2
votes
0 answers

Getting full blame history all at once for a given file

I'm working on a program that analyzes git blame history over time, starting with the first commit of a given file all the way to HEAD, along a given branch. Currently, the way I'm doing it is: Use git log --pretty='%H %ad' --date=unix to…
Jason C
  • 38,729
  • 14
  • 126
  • 182
2
votes
1 answer

How to get `git grep` to show `git blame`-like information

I'd like to git grep in the usual way, but with something like the additional insight of git blame in the displayed results. In some instances I probably would benefit from including the metadata in the search query (show only results written by…
sh1
  • 4,324
  • 17
  • 30
2
votes
1 answer

To display changes to the first line of a csv file tracked by git, can git log be on one line when using the -L line argument?

I would like to show only changes to the column headers of a csv file tracked by git. I use the code in this nice answer by Kirill Müller. It works almost perfectly except that it repeats the lines even if the commit didn't actually change the first…
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110
2
votes
0 answers

Get git blame for full Github repository via api

I'd like to get the output of git blame for all files in a repository recursively. I want to do this without cloning the repository first, by using Github's GraphQL v4 api. Is this possible? I've managed to get a list of files via this…
CiriousJoker
  • 552
  • 1
  • 7
  • 18
2
votes
1 answer

How to "revive" git blame history

I find myself in a precarious situation. I work on refactoring a big, existing codebase. I decided to comment out some tests and enable them gradually as I adapt the code. Unfortunately, I committed the commenting-out and now the git blame history…
LetsPlayYahtzee
  • 7,161
  • 12
  • 41
  • 65