diffgrep

command
v0.0.0-...-f64633d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package diffgrep prints portions of unified diff output, as produced many tools including git, that match (or don't match) a given pattern. If the input is a valid unified diff, the output is too.

For example, to exclude all Go test files from some git diff:

git diff some-other-branch | diffgrep -v -f '_test\.go$'

Usage:

diffgrep regex [flags]
Grep unified diff output for a pattern.
  -L	exclude whole files if they contain a match
  -a	search context too
  -d	search deleted content
  -f	grep file names instead of content
  -i	search inserted content
  -l	include whole files if they contain a match
  -v	invert results

See https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html for details of the format.

Credit to https://godoc.org/sourcegraph.com/sourcegraph/go-diff/diff for making it possible to implement this in less than an hour.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL