git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What does 'git blame --before <rev> -- <file>' supposed to mean?

From
Kevin Daudt <me@ikke.info>
Date
Aug 24, 2017, 07:58 UTC
Message-ID
<20170824075848.GG3839@alpha.vpn.ikke.info>
In-Reply-To
<1503254759.3881.9.camel@gmail.com>
On Mon, Aug 21, 2017 at 12:15:59AM +0530, Kaartic Sivaraam wrote:
Show 33 quoted lines
> Hello all,
> 
> I tried to do a 'git blame' on a file and wanted to see the blame
> before a particular revision of that file. I initially didn't know that
> you could achieve that with,
> 
>     $ git blame <rev> <file>
> 
> I thought I need to pass the revision as a parameter so I tried (before
> looking into the documentation) the command found in the subject. It
> worked but to my surprise it had the same result as,
> 
>     $ git blame -- <file>
> 
> I was confused and came to know from the documentation that blame
> doesn't have any '--before' option. That was even more surprising. Why
> does blame accept an option which it doesn't identify? Shouldn't it
> have warned that it doesn't accept the '--before' option? I guess it
> should not accept it because it confuses the user a lot as the could
> make it hard time for him to identify the issue.
> 
> 'git blame' doesn't seem to be the only command that accepts options
> not specified in the documentation there's 'git show' for it's company,
> 
>     $ git show --grep 'regex'
> 
> But the good thing with the above command is it behaves as expected. I
> suspect this should be documented, anyway.
> 
> Thoughts ?
> 
> -- 
> Kaartic

Git blame takes options that are fed to git rev-list, to limit the commits being taken into account for blaming.

The man page shows "[--since=<date>]", which is one such option, but before is valid as well.

git blame -h shows:
    <rev-opts> are documented in git-rev-list(1) 
and man git-blame shows under specifying ranges (emphasis mine): 
     When you are not interested in changes older than version v2.6.18,
     or changes older than 3 weeks, *you can use revision range
     specifiers similar to git rev-list*:
So these options are not documented under git blame, but git rev-list.

Perhaps the synopsis of man git-blame could be expanded so that that it's clear it accepts rev-list options.

Kevin
Previous: Kaartic SivaraamNext: Junio C Hamano
Message 2 of 3 in “What does 'git blame --before <rev> -- <file>' supposed to mean?”
  1. Kaartic SivaraamAug 20, 2017
  2. Kevin DaudtAug 24, 2017
  3. Junio C HamanoAug 24, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.