Skip to content

Instantly share code, notes, and snippets.

@tobiasbueschel
Last active March 31, 2022 11:52
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobiasbueschel/9ffa7754ddeb2a046d22f9b4054965da to your computer and use it in GitHub Desktop.
Save tobiasbueschel/9ffa7754ddeb2a046d22f9b4054965da to your computer and use it in GitHub Desktop.
Alias: ignore package-lock.json and yarn.lock in git diff

Don't want to see package-lock.json and yarn.lock in your git diff? Here are two nifty aliases that hide these files from your diff.

alias gd="git diff -- :!package-lock.json :!yarn.lock"
alias gds="git diff --staged -- :!package-lock.json :!yarn.lock"
@eliasnorrby
Copy link

You can also add entries to a .gitattributes file within your repo to exclude them from any diff output. This has the benefit of working every time git produces a diff, and not just when you use your alias.

package-lock.json -diff
yarn.lock -diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment