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).


On Mac

brew install mpv  

On Ubuntu

sudo add-apt-repository ppa:mc3man/mpv-tests  
sudo apt-get install mpv  

Quick Setup

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 <repository>/.git/hooks/post-commit file.


# Play fanfare on commit
mpv --no-video <Youtube URL> &> /dev/null

# Add other post-commit hooks


  • --no-vedio audio only, required for no UI popup
  • --start=<time> start from given position (sec)
  • --end=<time> end at given position (sec)

Full Setup

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.


# 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  


I love the classic victory fanfare from Final Fantasy series . Here it goes with Final Fantasy XV version!


Create a global git commit hook

You might enjoy:

Next post No more posts


comments powered by Disqus