0

Supposing to have a file (and its path) path/to/file in a specific version committed in a commit with a specific sha that we call hex_sha. After the use of git blame file/to/path hex_sha I get each row modified in that revision. For this example we assume to check the line with number line_i Supposing to have another prior date date_limit. How can I use git log to get how many times (or a list of commits) the line line_i in the file path/to/file has been modified from the revision with sha hex_sha to a specific date date_limit?

I tried: git log --since=date_limit origin..hex_sha -- -Lline_i,+1:path/to/file and other different arrangements of this command but nothing happens or git badly understand the file name. I have the impression that after -- while a target revision is present, git take the first argument after -- as file path. I'm sure that the date_limit is prior to the commit in exam.

F. Petrulio
  • 95
  • 2
  • 9
  • *Everything* after `--` is considered a path. – Romain Valeri Oct 13 '20 at 14:27
  • It was my concern, but can I specific other options that require -- (like since)? I'm reading https://git-scm.com/docs/git-log the guide says nothing about my problem – F. Petrulio Oct 13 '20 at 14:29
  • `--` *by itself*, as in `git something -- whatever`, indicates the end of options. `--option` does not. So `git something --foo --bar -- --baz` means that `--foo` and `--bar` are options to the `git-something` command, but `--baz` is a file name (or pathspec) to the `git-something` command. (Well, there is no `git-something` command, but if there were, that's what these would be.) – torek Oct 13 '20 at 17:36

0 Answers0