Return the number of commits in current git branch

You can use this action to get the number of commits of this branch. This is useful if you want to set the build number to the number of commits. See fastlane actions number_of_commits for more details.

Supported platforms ios, android, mac
Author @onevcat, @samuelbeek
Returns The total number of all commits in current git branch

2 Examples

increment_build_number(build_number: number_of_commits)
build_number = number_of_commits(all: true)
increment_build_number(build_number: build_number)


Key Description Default
all Returns number of all commits instead of current branch

* = default value is dependent on the user's system


To show the documentation in your terminal, run

fastlane action number_of_commits


It is recommended to add the above action into your Fastfile, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal

fastlane run number_of_commits

To pass parameters, make use of the : symbol, for example

fastlane run number_of_commits parameter1:"value1" parameter2:"value2"

It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"). Hashes are not currently supported.

It is recommended to add all fastlane actions you use to your Fastfile.

Source code

This action, just like the rest of fastlane, is fully open source, view the source code on GitHub

Back to actions