From a3750689d666697212ff278ca7fe43017475b628 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sun, 18 Jul 2021 10:46:47 +0300 Subject: [PATCH] Git uncommitted alias and script. --- .config/git/config | 2 +- Documents/bin/git-uncommitted | 5 +++++ Documents/bin/uncommitted | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 Documents/bin/git-uncommitted create mode 100755 Documents/bin/uncommitted diff --git a/.config/git/config b/.config/git/config index 13c5137..033d812 100644 --- a/.config/git/config +++ b/.config/git/config @@ -19,7 +19,7 @@ merg = merge --no-edit pop = stash pop posh = push --set-upstream origin HEAD - pre-commit = ! pre-commit run --files $(git diff --name-only) $(git diff --cached --name-only) + pre-commit = ! pre-commit run --files $(git uncommitted) Pull = pull --progress --ff --tags pull-force = !git fetch && git reset --hard "$(git tracking)" pushes = !git remote | xargs -n1 git push diff --git a/Documents/bin/git-uncommitted b/Documents/bin/git-uncommitted new file mode 100755 index 0000000..3439a5a --- /dev/null +++ b/Documents/bin/git-uncommitted @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +git diff --name-only +git diff --name-only --cached diff --git a/Documents/bin/uncommitted b/Documents/bin/uncommitted new file mode 100755 index 0000000..97e1d9f --- /dev/null +++ b/Documents/bin/uncommitted @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu + +# shellcheck disable=SC2016 +find ~/Repositories -maxdepth 5 -name .git -type d -print0 | + xargs --null dirname --zero | + xargs --null --replace /bin/sh -c 'f () { [ -z "$(git -C "$1" uncommitted)" -o -z "$(git -C "$1" remote -v)" ] || echo "$1"; }; f '\''{}'\''' -- GitLab