{"id":13994626,"url":"https://github.com/keith/diff-grep","last_synced_at":"2025-09-07T02:09:24.354Z","repository":{"id":38328624,"uuid":"307895886","full_name":"keith/diff-grep","owner":"keith","description":"Filter matching hunks in diffs","archived":false,"fork":false,"pushed_at":"2022-12-17T20:00:25.000Z","size":37,"stargazers_count":28,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-09T03:22:56.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-28T03:25:22.000Z","updated_at":"2023-04-24T18:57:31.000Z","dependencies_parsed_at":"2023-01-29T18:00:54.752Z","dependency_job_id":null,"html_url":"https://github.com/keith/diff-grep","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fdiff-grep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fdiff-grep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fdiff-grep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fdiff-grep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keith","download_url":"https://codeload.github.com/keith/diff-grep/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235053746,"owners_count":18928440,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-09T14:02:59.935Z","updated_at":"2025-01-22T02:50:08.478Z","avatar_url":"https://github.com/keith.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# diff-grep\n\n`diff-grep` is a tool for filtering diffs to only include the hunks\nmatching the given patterns.\n\n## Usage\n\nProduce a diff, for example using `git diff`:\n\n```diff\n$ git diff ... \u003e /tmp/original.diff\n$ cat /tmp/original.diff\ndiff --git c/docs/ld.1.html w/docs/ld.1.html\nindex 2ac7626c..eeb7bdc5 100644\n--- c/docs/ld.1.html\n+++ w/docs/ld.1.html\n@@ -897,7 +903,16 @@ When linking for two-level namespace, \u003ccode class=\"Nm\"\u003eld\u003c/code\u003e does not verify\n       build time. This option relaxes that requirement, allowing you to mix\n       object files compiled for different ARM subtypes.\u003c/dd\u003e\n   \u003cdt\u003e\u003ca class=\"permalink\" href=\"#no_uuid\"\u003e\u003ccode class=\"Fl\" id=\"no_uuid\"\u003e-no_uuid\u003c/code\u003e\u003c/a\u003e\u003c/dt\u003e\n-  \u003cdd\u003eDo not generate an LC_UUID load command in the output file.\u003c/dd\u003e\n+  \u003cdd\u003eDo not generate an LC_UUID load command in the output file. Be warned that\n+      binaries without UUIDs may cause the debugger and crash reporting tools to\n+      be unable to track and inspect the binary.\u003c/dd\u003e\n+  \u003cdt\u003e\u003ca class=\"permalink\" href=\"#random_uuid\"\u003e\u003ccode class=\"Fl\" id=\"random_uuid\"\u003e-random_uuid\u003c/code\u003e\u003c/a\u003e\u003c/dt\u003e\n+  \u003cdd\u003eGenerate a random LC_UUID load command in the output file. By default the\n+      linker generates the UUID of the output file based on a hash of the output\n+      file's content. But for very large output files, the hash can slow down\n+      the link. Using a hash based UUID is important for reproducible builds,\n+      but if you are just doing rapid debug builds, using -random_uuid may\n+      improve turn around time.\u003c/dd\u003e\n   \u003cdt\u003e\u003ca class=\"permalink\" href=\"#root_safe\"\u003e\u003ccode class=\"Fl\" id=\"root_safe\"\u003e-root_safe\u003c/code\u003e\u003c/a\u003e\u003c/dt\u003e\n   \u003cdd\u003eSets the MH_ROOT_SAFE bit in the mach header of the output file.\u003c/dd\u003e\n   \u003cdt\u003e\u003ca class=\"permalink\" href=\"#setuid_safe\"\u003e\u003ccode class=\"Fl\" id=\"setuid_safe\"\u003e-setuid_safe\u003c/code\u003e\u003c/a\u003e\u003c/dt\u003e\n@@ -1315,7 +1330,7 @@ as(1), ar(1), cc(1), nm(1), otool(1) lipo(1), arch(3), dyld(3), Mach-O(5),\n \u003c/div\u003e\n \u003ctable class=\"foot\"\u003e\n   \u003ctr\u003e\n-    \u003ctd class=\"foot-date\"\u003eMarch 7, 2018\u003c/td\u003e\n+    \u003ctd class=\"foot-date\"\u003eAugust 7, 2020\u003c/td\u003e\n     \u003ctd class=\"foot-os\"\u003eDarwin\u003c/td\u003e\n   \u003c/tr\u003e\n \u003c/table\u003e\n```\n\nFilter the diff where every modified line in a hunk must match the given\npattern(s):\n\n```diff\n$ cat /tmp/original.diff | diff-grep foot-date --output /tmp/filtered.diff\n$ cat /tmp/filtered.diff\n--- c/docs/ld.1.html\n+++ w/docs/ld.1.html\n@@ -1315,7 +1330,7 @@ as(1), ar(1), cc(1), nm(1), otool(1) lipo(1), arch(3), dyld(3), Mach-O(5),\n \u003c/div\u003e\n \u003ctable class=\"foot\"\u003e\n   \u003ctr\u003e\n-    \u003ctd class=\"foot-date\"\u003eMarch 7, 2018\u003c/td\u003e\n+    \u003ctd class=\"foot-date\"\u003eAugust 7, 2020\u003c/td\u003e\n     \u003ctd class=\"foot-os\"\u003eDarwin\u003c/td\u003e\n   \u003c/tr\u003e\n \u003c/table\u003e\n```\n\nUse the filtered diff somewhere:\n\n```sh\n$ git apply --reverse /tmp/filtered.diff\n```\n\nIn this example, we revert only the matching hunk using `git apply\n--reverse`. This can be useful when you want to stage, or checkout,\nlarge mechanical diffs that you have intertwined other changes with.\n\n## Installation\n\n[Homebrew](https://brew.sh):\n\n```sh\nbrew install keith/formulae/diff-grep\n```\n\nManually, after [installing rust](https://rustup.rs/):\n\n```sh\ncargo install --locked --path .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeith%2Fdiff-grep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeith%2Fdiff-grep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeith%2Fdiff-grep/lists"}