Boost Productivity by Fanfare on Code Commit
Working on an exciting project is like a great adventure! Every code commit is a victory towards to the battle of new features. Why not celebrate with musical flourish? Uplifting fanfare will inspire you to fight the next combat!
This is a tutorial of how to play your favorite short music from Youtube on Git code commit.
Mplayer and mpv are two popular media players on Linux. We choose mpv because mplayer requires extra setup to accept https protocol (open-ssl).
brew install mpv
sudo add-apt-repository ppa:mc3man/mpv-tests sudo apt-get install mpv
If you don't have any git hook yet, go to Full Setup section. To play short music from Youtube, simply add one line of code in
#!/bin/sh # Play fanfare on commit mpv --no-video <Youtube URL> &> /dev/null # Add other post-commit hooks
--no-vedioaudio only, required for no UI popup
--start=<time>start from given position (sec)
--end=<time>end at given position (sec)
You can create a global git commit hook. And pass hook setup to desired existing repository.
Enable git templates
git config --global init.templatedir '~/.git-templates' mkdir -p ~/.git-templates/hooks
Write hooks in
~/.git-templates/hooks. For playing music when git commit completed, edit post-commit hook in
~/.git-templates/hooks/post-commit. Same step as in Quick Setup.
#!/bin/sh # Play fanfare on commit mpv --no-video <Youtube URL> &> /dev/null
And make the hook executable
chmod a+x ~/.git-templates/hooks/post-commit
For any repository you would like to enable the hook we just created, re-initialize git in existing repository.
cd <repository path> git init