From 83496bf8c53dff9f04bf4d83155308fb69d7e94c Mon Sep 17 00:00:00 2001 From: Ryan Collingham Date: Sun, 3 Sep 2017 21:49:38 +0100 Subject: [PATCH] Add option to specify branch name --- README.md | 2 ++ git-recall | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ef8eb8..0771e5a 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ check what you or other contributors in your team did. It doesn't aim to be a re ```sh $ git recall [-a ] [-d ] + [-b ] [-f] [-h] [-v] @@ -25,6 +26,7 @@ $ git recall [-a ] - `-a` - Restrict search for a specific user (use -a "all" for all users) - `-d` - Display commits for the last n days +- `-b` - Specify branch to display commits from - `-f` - Fetch the latest changes - `-h` - Show help screen - `-v` - Show version diff --git a/git-recall b/git-recall index c4d346a..da74bac 100644 --- a/git-recall +++ b/git-recall @@ -8,6 +8,7 @@ usage() { Options: -d, --date Show logs for last n days. -a, --author Author name. + -b, --branch Specify branch to display commits from. -f, --fetch fetch commits. -h, --help This message. -v, --version Show version. @@ -27,6 +28,7 @@ COMMITS_UNCOL=() # commits without colors SED_CMD="" # Sed command to use according OS. LESSKEY=false VERSION="1.2.2" +BRANCH="" # Set key bindings. au="`echo -e '\e[A'`" # arrow up @@ -87,6 +89,10 @@ while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do usage exit ;; + -b | --branch ) + BRANCH="$2" + shift + ;; * ) echo "abort: unknown argument" 1>&2 exit 1 @@ -128,7 +134,7 @@ GIT_FORMAT="%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%a # Log command. GIT_LOG="git log --pretty=format:'${GIT_FORMAT}' --author \"$AUTHOR\" - --since \"$SINCE\" --abbrev-commit --no-merges" + --since \"$SINCE\" --abbrev-commit --no-merges $BRANCH" # Change temporary the IFS to store GIT_LOG's output into an array. IFS=$'\n'