Ravi Mistry 52890fcfd4 blame: ignore revs in .git-blame-ignore-revs by default
git-blame(1) can ignore a list of commits specified via
--ignore-revs-file or the blame.ignoreRevsFile configuration variable.
This is useful for skipping uninteresting revisions such as tree-wide
formatting changes, large-scale refactors, and code modernizations that
would otherwise obscure genuine historical authorship.

When revision-ignoring was introduced in commit ae3f36dea1 ("blame: add
blame.ignoreRevsFile config option", 2019-10-18), it intentionally
avoided adopting a default ignore file. At the time, the capability was
new and unproven, so avoiding unrequested filesystem I/O or unexpected
attribution shifts took priority over a project-wide default.
Requiring explicit opt-in per clone was therefore the prudent design.

Since then, maintaining a .git-blame-ignore-revs file at the top level
of the repository has become the standard convention across the Git
ecosystem, adopted by many open source projects (such as Chromium and
LLVM) as well as hosting platforms (GitHub, GitLab, Gerrit). However,
git-blame(1) and git-annotate(1) still ignore this file unless each
user remembers to manually configure blame.ignoreRevsFile in every
local clone.

Teach git-blame(1) and git-annotate(1) to automatically add
.git-blame-ignore-revs, if it exists, as the initial element in the
list of ignore-revs files. Similar to how read_mailmap() handles
.mailmap, consult .git-blame-ignore-revs at the root of the working
tree when a working tree is available, and otherwise consult the
HEAD:.git-blame-ignore-revs blob in bare repositories. Reading only
from the working tree in non-bare repositories makes it ergonomic to
prepare a new .git-blame-ignore-revs file, edit an existing one, or
remove a committed one and immediately test the effect with
git-blame(1) before committing, while consulting
HEAD:.git-blame-ignore-revs in bare repositories allows them to
respect the committed ignore list as well.

To ensure consistent precedence, override semantics, and safety when
reading upstream-controlled content:
- The default .git-blame-ignore-revs entry is added before reading
  configuration and CLI options, preserving user and repository config
  overrides.
- In git_blame_config(), blame.ignoreRevsFile entries are appended via
  string_list_append() rather than inserted in sorted order via
  string_list_insert() so that configuration entries preserve their
  order relative to the initial default entry.
- When a working tree is present, the working-tree
  .git-blame-ignore-revs path is checked with lstat() and S_ISREG(),
  opened with open_nofollow(), and verified with fstat() and S_ISREG()
  so symbolic links and non-regular files are silently skipped. In bare
  repositories, HEAD:.git-blame-ignore-revs is resolved quietly via
  get_oid_with_context() and its tree entry mode is checked with
  S_ISREG() before checking the object.
- In both modes, the file or blob size is capped at
  IGNORE_REVS_MAX_FILE_SIZE (100MB, matching ATTR_MAX_FILE_SIZE from
  3c50032ff5 ("attr: ignore overly large gitattributes files",
  2022-12-01)) before reading its contents, skipping an oversized file
  or blob with a warning without loading it into memory. The contents
  are parsed via a new oidset_parse_buffer_carefully() helper in
  oidset.c that shares line parsing with oidset_parse_file_carefully().
- In build_ignorelist(), ignore-revs entries are processed starting
  after the last empty string entry. This ensures setting
  blame.ignoreRevsFile to "" or passing --ignore-revs-file "" or
  --no-ignore-revs-file cleanly discards the default entry without
  attempting to read or parse it, allowing users to bypass a malformed
  default ignore-revs file.

Update documentation in blame-options.adoc and config/blame.adoc, and
add test coverage in t8013 for the default working-tree lookup,
uncommitted and untracked .git-blame-ignore-revs files, subdirectory
invocations, bare repositories, CLI and config overrides, symbolic
links, overly large files and blobs, and comments and whitespace
handling.

Based-on-patch-by: Abhijeetsingh Meena <abhijeet040403@gmail.com>
Helped-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Ravi Mistry <rmistry@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-13 13:35:24 -07:00
…
…
2026-09-27 20:41:50 +08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2026-07-16 14:10:08 -07:00
2026-07-16 14:10:08 -07:00
…
…
…
…
…
2026-08-24 13:17:51 -07:00
…
…
…
…
…
…
…
…
…
2026-10-01 11:28:16 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
2026-07-16 23:05:47 -07:00
…
…
2026-09-14 14:02:52 -07:00
…
…
…
…
…
2026-07-15 13:24:19 -07:00
…
…
…
…
2026-07-31 08:52:16 -07:00
…
…
…
…
…
…
…
…
…
2026-07-06 15:50:23 -07:00
…
…
…
…
…
2026-08-23 11:11:07 +02:00
…
…
…
2026-09-24 11:22:13 -07:00
2026-10-01 11:28:16 -07:00
…
…
2026-10-01 11:26:39 -07:00
…
2026-10-01 11:26:40 -07:00
2026-10-01 11:26:40 -07:00
2026-07-07 10:49:40 -07:00
…
2026-08-18 09:31:36 -07:00
…
…
…
…
…
…
…
…
2026-07-14 12:54:25 -07:00
2026-07-14 12:54:25 -07:00
…
…
2026-07-07 10:49:40 -07:00
…
…
…
…
…
…
2026-09-07 09:32:05 -07:00
2026-07-23 07:14:34 -07:00
…
…
…
…
…
…
…
…
…
…

GitHub build status GitLab build status

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.adoc to get started, then see Documentation/giteveryday.adoc for a useful minimum set of commands, and Documentation/git-<commandname>.adoc for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.adoc (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission and Documentation/CodingGuidelines).

Those wishing to help with error message, usage and informational message string translations (localization l10) should see po/README.md (a po file is a Portable Object file that holds the translations).

To subscribe to the list, send an email to git+subscribe@vger.kernel.org (see https://subspace.kernel.org/subscribing.html for details). The mailing list archives are available at https://lore.kernel.org/git/, https://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the "What's cooking" reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name "git" was given by Linus Torvalds when he wrote the very first version. He described the tool as "the stupid content tracker" and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • "global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • "goddamn idiotic truckload of sh*t": when it breaks
Languages
C 49.8%
Shell 39.8%
Perl 4.3%
Tcl 3%
Python 0.8%
Other 2.1%