From 255ef8d5877f056e80751f45d264326de1688e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tvrtko=20Majstorovi=C4=87?= Date: Sat, 23 May 2020 18:57:13 +0200 Subject: [PATCH] git: add alias for git diff excluding lock files (#8935) --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index dde60fe13..8642dd055 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -62,6 +62,7 @@ plugins=(... git) | gdct | git describe --tags $(git rev-list --tags --max-count=1) | | gds | git diff --staged | | gdt | git diff-tree --no-commit-id --name-only -r | +| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock" | | gdv | git diff -w $@ \| view - | | gdw | git diff --word-diff | | gf | git fetch | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 855a746b4..1112421bf 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -86,6 +86,11 @@ alias gds='git diff --staged' alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdw='git diff --word-diff' +function gdnolock() { + git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock" +} +compdef _git gdnolock=git-diff + function gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff