diff --git a/git_foreach_branch.sh b/git_foreach_branch.sh index 62d1ba09..05ac09c6 100755 --- a/git_foreach_branch.sh +++ b/git_foreach_branch.sh @@ -26,6 +26,24 @@ srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" #. "$srcdir/.bash.d/functions.sh" . "$srcdir/.bash.d/git.sh" -foreachbranch "$@" +usage_description=" +Run a command against each Git branch in the current repo checkout + +Checks out each branch and runs the command, before returning to the original branch + +If the command fails on a branch, this script will exit and leave you checked out on that branch + +One use case for this is merging your trunk branch into all your feature branches in an automated manner + +This is powerful so use carefully! +" -git checkout master +# used by usage() in lib/utils.sh +# shellcheck disable=SC2034 +usage_args=" " + +help_usage "$@" + +min_args 1 "$@" + +foreachbranch "$@"