K.R.
K.R.

Reputation: 422

In Bash, how to pass a git argument to a function whose body is a git statement

I have this function

git_list_bad_commits() {
    git rev-list master..HEAD --oneline -i ${grep:1}
}

Sometimes I want to call it just as it is.

Sometimes I want to call it with the addition of the git argument --count

How do I do that?

Upvotes: 0

Views: 41

Answers (1)

l0b0
l0b0

Reputation: 58978

Just add the function arguments to the command:

git_list_bad_commits() {
    git rev-list master..HEAD "$@" --oneline -i ${grep:1}
}

Upvotes: 1

Related Questions