Skip to content

Commit

Permalink
Create a git_do command to log git actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromebaum committed Sep 25, 2012
1 parent 53e9c76 commit 5bca8d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions git-flow
Expand Up @@ -80,6 +80,11 @@ main() {
# use the shFlags project to parse the command line arguments
. "$GITFLOW_DIR/gitflow-shFlags"
FLAGS_PARENT="git flow"

# allow user to request git action logging
DEFINE_boolean show_commands false 'show actions taken (git commands)' g

# do actual parsing
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"

Expand Down
8 changes: 8 additions & 0 deletions gitflow-common
Expand Up @@ -70,6 +70,14 @@ noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
# Git specific common functionality
#

git_do() {
# equivalent to git, used to indicate actions that make modifications
if flag show_commands; then
echo "git $@" >&2
fi
git "$@"
}

git_local_branches() { git branch --no-color | sed 's/^[* ] //'; }
git_remote_branches() { git branch -r --no-color | sed 's/^[* ] //'; }
git_all_branches() { ( git branch --no-color; git branch -r --no-color) | sed 's/^[* ] //'; }
Expand Down

0 comments on commit 5bca8d9

Please sign in to comment.