This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # You can see how far along the master branch you are, how many | |
| # commits you diverged from the master branch, and the commit hash | |
| # the version is generated from | |
| NEAREST_COMMON_ANCESTOR=$(git merge-base origin/master HEAD) | |
| MASTER_COUNT=$(git rev-list --first-parent --count "$NEAREST_COMMON_ANCESTOR") | |
| HEAD_COUNT=$(git rev-list --first-parent --count HEAD) | |
| COUNT_DIFF=$((HEAD_COUNT-MASTER_COUNT)) | |
| SHORT_COMMIT_HASH=$(git rev-parse --short HEAD) |