Skip to content

How can I auto-update a metadata file on each commit using Git/GitHub Desktop? #163400

Discussion options

You must be logged in to vote

Hey @ghareh-gozlou 👋

Awesome question — I’ve tackled something similar when I wanted auto-updated metadata blocks (especially for tracking versioning and timestamps). Since GitHub Desktop doesn't support Git hooks, here are a few flexible workarounds you can try:

Option 1: Use a Pre-commit Script + Git Alias

Even though GitHub Desktop doesn't run hooks directly, you can:

  1. Write a small script (e.g., in Python, Bash, or PowerShell) to:

    • Parse your .pl or target file
    • Insert/update a metadata block with:
      • Current date
      • Commit author (git config user.name)
      • Latest commit hash (git rev-parse HEAD)
      • Auto-increment version (store it in a file, bump it)
  2. Create a Git alias or a simple double-cl…

Replies: 2 comments 1 reply

This comment was marked as off-topic.

@ghareh-gozlou
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GitHub Desktop Sync your code to your computer with a simple desktop app New To GitHub 👋 New To GitHub Question Ask and answer questions about GitHub features and usage
3 participants