Skip to content

kelvinxiao01/devtag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devtag

Play an audio clip of your choice every time you run git push or git pull. macOS only.

Once set up, every git push and git pull from any repo, any shell, any IDE will trigger the audio.

Install

brew install kelvinxiao01/devtag/devtag

If this is your first time tapping the repo, Homebrew will do that automatically. To tap manually:

brew tap kelvinxiao01/devtag
brew install devtag

Setup

Two commands and you're done.

1. Pick the audio file to play:

devtag set /path/to/your/audio.mp3

Supported formats are whatever macOS's afplay accepts: .mp3, .wav, .aiff, .m4a, .aac, .caf, .au, Apple Lossless. (Not supported: FLAC, OGG, OPUS.)

Try it with a built-in system sound to sanity-check:

devtag set /System/Library/Sounds/Glass.aiff
devtag play

Optionally, give push and pull different sounds. An event without its own sound falls back to the default from devtag set <path>:

devtag set push /System/Library/Sounds/Hero.aiff
devtag set pull /System/Library/Sounds/Submarine.aiff
devtag play push
devtag play pull

2. Wire up the global git hooks:

devtag install

That's it. Try git push or git pull in any repo with a remote — audio should play as the push starts or the pull completes.

Commands

Command What it does
devtag set <path> Save the default audio file, played on both push and pull.
devtag set push <path> Save an audio file played only on git push.
devtag set pull <path> Save an audio file played only on git pull.
devtag get Print the currently configured audio paths.
devtag play [push|pull] Play the configured audio (also used internally by the git hooks).
devtag install Install the global git hooks (pre-push, post-merge, post-rewrite).
devtag install --force Overwrite an existing core.hooksPath setting.
devtag uninstall Remove the hooks and unset core.hooksPath.
devtag --help Show usage.

How it works

devtag install does two things:

  1. Writes hook scripts to ~/.devtag/hooks/:
    • pre-push — fires on git push.
    • post-merge — fires after a git pull (or git merge) that brings in changes.
    • post-rewrite — fires after a git pull --rebase (it ignores commit --amend).
  2. Runs git config --global core.hooksPath ~/.devtag/hooks so git uses that directory for hooks in every repo on the machine.

Each hook runs devtag play in the background and immediately exits 0, so audio never delays or aborts your push or pull.

Note: git has no pull-specific hook, so post-merge/post-rewrite are the closest fit. A pull that's already up to date plays nothing, and a local git merge or git rebase that changes anything also plays the sound.

Heads-up: per-repo hooks

While devtag is installed, git uses ~/.devtag/hooks/ for hooks instead of each repo's .git/hooks/. If you (or tools like Husky, pre-commit, lefthook) rely on per-repo hooks, those will not fire.

To check whether you have any per-repo hooks that would be silenced, scan your workspace:

find ~/Code ~/projects -maxdepth 6 -type d -name hooks -path "*/.git/hooks" 2>/dev/null \
  | while read d; do
      files=$(ls "$d" 2>/dev/null | grep -v '\.sample$' || true)
      [ -n "$files" ] && { echo "REPO: $(dirname $(dirname $d))"; echo "$files" | sed 's/^/  /'; }
    done

Swap ~/Code ~/projects for wherever you keep your repos. Anything that prints is a real hook that devtag install would silence.

If devtag install detects you already have core.hooksPath set to something else, it refuses to overwrite unless you pass --force.

Uninstall

Order matters — run devtag uninstall before brew uninstall, otherwise the hook and core.hooksPath setting get left behind.

devtag uninstall
brew uninstall devtag

Optionally:

brew untap kelvinxiao01/devtag    # stop pulling formula updates
rm -rf ~/.devtag                  # remove the saved audio-path config

If you uninstalled in the wrong order, clean up by hand:

git config --global --unset core.hooksPath
rm -rf ~/.devtag

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages