Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you suppress the --show-name (filename) option when git blame?

Tags:

git

-f, --show-name
       Show the filename in the original commit. By default the filename is shown if there is any line that came from a file with a different name, due to rename detection.

But --show-name=off does not work.

error: option `show-name' takes no value
usage: git blame [<options>] [<rev-opts>] [<rev>] [--] <file>

How could I hide the verbose filenames from output?

like image 465
Frank Fang Avatar asked Nov 09 '15 02:11

Frank Fang


People also ask

How Do I Get Out of git blame?

You can also quit the git blame window using the q key on your keyboard. Now, if you want to learn more about what changed in a commit, simply copy the commit hash and use git log as follows.

How do I blame a file in git?

The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was. The output format of git blame can be altered with various command line options.

What is annotate with git blame?

The git blame command annotates lines with information from the revision which last modified the line, and... with Git 2.22 (Q2 2019), will do so faster, because of a performance fix around " git blame ", especially in a linear history (which is the norm we should optimize for).

Why is it called git blame?

In case you don't know git-blameIf you want to know who last changed a particular chunk of code, you use Git to run a special command. That command is called blame. In other words, you don't ask who the author is, you ask who's to blame for a particular contribution.


1 Answers

This option was introduced in commit eb93b724 (git 1.4.4, Oct. 2006)

The new option makes the command's native output format show the filename even when there were no renames in its history, to make it simpler for Porcelains to parse its output.

That means:

  • not using this option is the way to have it "off"
  • when there is rename in history, the filename is always shown.

As mentioned in Edouard Poor's answer, you can use git blame -c, which forces the same output mode as git-annotate.

like image 118
VonC Avatar answered Oct 04 '22 00:10

VonC