{"id":13692500,"url":"https://github.com/josephfrazier/prettier-diff","last_synced_at":"2025-04-30T05:22:08.719Z","repository":{"id":48000520,"uuid":"86617171","full_name":"josephfrazier/prettier-diff","owner":"josephfrazier","description":"`git diff` wrapper for semantic JavaScript/JSON diffs","archived":false,"fork":false,"pushed_at":"2023-04-18T15:19:32.000Z","size":323,"stargazers_count":36,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T20:49:52.561Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npm.im/prettier-diff","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josephfrazier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-03-29T18:40:57.000Z","updated_at":"2023-04-18T15:19:49.000Z","dependencies_parsed_at":"2024-04-08T02:09:53.721Z","dependency_job_id":"fc0861ea-0062-4e66-ba5b-741cac390b9e","html_url":"https://github.com/josephfrazier/prettier-diff","commit_stats":{"total_commits":214,"total_committers":2,"mean_commits":107.0,"dds":0.02336448598130836,"last_synced_commit":"598d3eb7f179e506b75389ccc59affd3ade5b930"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephfrazier%2Fprettier-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephfrazier%2Fprettier-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephfrazier%2Fprettier-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephfrazier%2Fprettier-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josephfrazier","download_url":"https://codeload.github.com/josephfrazier/prettier-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251645984,"owners_count":21620846,"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-02T17:00:58.719Z","updated_at":"2025-04-30T05:22:08.701Z","avatar_url":"https://github.com/josephfrazier.png","language":"JavaScript","readme":"# prettier-diff\n\n`prettier-diff` is a `git diff` wrapper that preprocesses JavaScript and JSON files to reduce the number of formatting changes that appear in the diff.\nThis allows you to focus on the semantic changes, which is useful when viewing diffs that also have formatting changes.\n\nJavaScript is preprocessed with [prettier], and JSON is preprocessed with [json-stable-stringify] and [json-align].\n\n[prettier]: https://github.com/prettier/prettier\n[json-stable-stringify]: https://github.com/substack/json-stable-stringify\n[json-align]: https://github.com/nylen/node-json-align\n\n## Installation\n\nYou can use [yarn] or [npm] to install `prettier-diff`:\n\n```bash\nyarn global add prettier-diff\n# or\nnpm install --global prettier-diff\n```\n\n## Usage\n\n### One-off usage\n\nIn any git repository, just use `prettier-diff` instead of `git diff`:\n\n```bash\n# instead of\ngit diff head^^\n# do this\nprettier-diff head^^\n```\n\nBehind the scenes, `prettier-diff` temporarily modifies the `.git/config` and `.git/info/attributes` files to set up the preprocessing by defining a [textconv] for all files.\n\n### `git diff` integration\n\nTo always use `prettier-diff` as part of `git diff` in a given repository, you can run the following:\n\n```bash\ngit config diff.prettier.textconv textconv-prettier\n\necho '*.js diff=prettier' \u003e\u003e .gitattributes\necho '*.json diff=prettier' \u003e\u003e .gitattributes\n```\n\nNow, `git diff` will automatically run `prettier-diff` on your JS/JSON files, and it plays well with the other `git diff` options like `--ignore-all-space`, as well as [diff-so-fancy].\nSee here for more information: [textconv]\n\n[yarn]: https://yarnpkg.com/en/docs/getting-started\n[npm]: https://www.npmjs.com/get-npm\n[diff-so-fancy]: https://github.com/so-fancy/diff-so-fancy\n[textconv]: https://git.wiki.kernel.org/index.php/Textconv\n\n## Examples\n\nFor example, this repository contains a large commit that rewrote most of its code with [prettier-standard], and also renames a variable. You can see the commit on GitHub here: [8cc0119]\n\nWith `prettier-diff`, only the renaming is shown:\n\n```bash\nprettier-diff 8cc0119^ 8cc0119 --color | diff-so-fancy\n```\n\n![screenshot of `prettier-diff 8cc0119^ 8cc0119 --color | diff-so-fancy`](screenshot.png)\n\n[prettier-standard]: https://github.com/sheerun/prettier-standard\n[8cc0119]: https://github.com/josephfrazier/prettier-diff/commit/8cc0119e3969132670e6b13cde1583280fababa5\n","funding_links":[],"categories":["Other Text Formats"],"sub_categories":["Diff Enhancers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephfrazier%2Fprettier-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosephfrazier%2Fprettier-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephfrazier%2Fprettier-diff/lists"}