Skip to content

Commit 5bca8d9

Browse files
committed
Create a git_do command to log git actions
1 parent 53e9c76 commit 5bca8d9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

git-flow

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ main() {
8080
# use the shFlags project to parse the command line arguments
8181
. "$GITFLOW_DIR/gitflow-shFlags"
8282
FLAGS_PARENT="git flow"
83+
84+
# allow user to request git action logging
85+
DEFINE_boolean show_commands false 'show actions taken (git commands)' g
86+
87+
# do actual parsing
8388
FLAGS "$@" || exit $?
8489
eval set -- "${FLAGS_ARGV}"
8590

gitflow-common

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
7070
# Git specific common functionality
7171
#
7272

73+
git_do() {
74+
# equivalent to git, used to indicate actions that make modifications
75+
if flag show_commands; then
76+
echo "git $@" >&2
77+
fi
78+
git "$@"
79+
}
80+
7381
git_local_branches() { git branch --no-color | sed 's/^[* ] //'; }
7482
git_remote_branches() { git branch -r --no-color | sed 's/^[* ] //'; }
7583
git_all_branches() { ( git branch --no-color; git branch -r --no-color) | sed 's/^[* ] //'; }

0 commit comments

Comments
 (0)