Skip to content

Instantly share code, notes, and snippets.

View reubenavery's full-sized avatar

Reuben Avery reubenavery

  • NBC News Digital
  • Brooklyn NY
View GitHub Profile
@shadowmoose
shadowmoose / pre-commit
Last active February 22, 2024 14:25
Git pre-commit hook to make sure you incremented your program's internal version variable.
#!/usr/bin/env bash
# Checks the latest release version of your GitHub project, and makes sure the local version variable has been incremented.
# This script will run before any commits happen, and interrupt if the local version has not been incremented since the last release.
# It's intended for use with projects who primarily increment versions around their release schedule.
#
# Requires that GitHub releases use tags that match the internal version. Supports oAuth info in the event of GitHub rate limiting.
# The parsing done in here is super hacky, but it's fast and it works cross-platform with minimal requirements.
# Works with any version tag format you use, and should be runnable on Windows/Linux.
#
# TO USE: