From 0acfe2d5d0e9b971dd3b6b46ab35d184327a225c Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 5 Oct 2023 18:09:48 +0200 Subject: [PATCH] git: Add word-wise diff as quick alias Since I often use git for prose and textual writing, wordwise diffs make a lot of sense to have quick access to. This commit sets up a git-internal alias `git diffword` as well as an even shorter `gdd` (diff) and `gdds` (diff staged) which mimic the other diff aliases `gd`/`gds` already existing. --- git/.config/git/config | 1 + git/.config/sh/alias.d/git.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/git/.config/git/config b/git/.config/git/config index e8d9579..8f56266 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -22,6 +22,7 @@ last = "diff HEAD~ HEAD" pushall = "!git remote | xargs -I R git push R" # push to all connected remotes fetchall = "!git remote | xargs -I R git fetch R" # fetch from all connected remotes + diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose [commit] gpgsign = true # sign commits as me verbose = true # Always show diff when preparing commit message diff --git a/git/.config/sh/alias.d/git.sh b/git/.config/sh/alias.d/git.sh index 372b1ec..ad465f6 100644 --- a/git/.config/sh/alias.d/git.sh +++ b/git/.config/sh/alias.d/git.sh @@ -32,7 +32,9 @@ fi alias gco='git checkout' alias gd='git diff' +alias gdd='git diffword' alias gds='git diff --staged' +alias gdds='git diffword --staged' alias gi='git ignore'