Skip to content

Instantly share code, notes, and snippets.

@tobiasbueschel
Last active October 10, 2024 13:30
Show Gist options
  • 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"
@Monstarrrr
Copy link

I get bash: !package: event not found

@tobiasbueschel
Copy link
Author

just btw, you can add such aliases directly to your ~/.gitconfig, like so:

That's right :) but that would still require you to prefix each command with git such as: git d vs. just typing the following in your terminal gd.

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