From 69005f87e6f8a3b769f1119e881565cb5cb23ff8 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Tue, 7 Mar 2017 12:20:26 -0500 Subject: [PATCH] Adds git helper functions --- functions/git_functions.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/functions/git_functions.sh b/functions/git_functions.sh index e387e1ea3..51b70c55c 100644 --- a/functions/git_functions.sh +++ b/functions/git_functions.sh @@ -4,6 +4,21 @@ function wgbranch { } +# git status "plumbing" version +# Useful for piping into grep -> xargs git add +function wgst { + git status -s | awk '{ print $2 }' +} + + +# git add by file regex pattern +function wgadd { + pattern="$2" + + wgst | grep "${pattern}" | xargs git add +} + + # compare file with another branch function wgcompare_file { file_path="$1"