How can I play sound whenever I pass git?

Writing a house code can be insulating. There you are, day after day, calmly doing magic with your mind (sarcasm, obv.), To only aimlessly transfer the fruits of your labor into the void of your original control repository, which no one has appreciated. If only a crowd of children could be preserved for the sole purpose - to cheer you up every time you finish something.

How can I play the winning sound every time I commit Git?

+5
source share
1 answer

Surprisingly, Brandon Keepers from the Collective Idea thought the same way . Anyway, this is what my version of his script looks like:

#!/bin/sh toplevel_path='git rev-parse --show-toplevel' afplay -v 0.1 $toplevel_path/.git/hooks/happykids.wav > /dev/null 2>&1 & 

I put this in a file called .git/hooks/post-commit.playsound . Then I run this from the main .git/hooks/post-commit script as follows:

 #!/bin/sh toplevel_path='git rev-parse --show-toplevel' $toplevel_path/.git/hooks/post-commit.tweet $toplevel_path/.git/hooks/post-commit.playsound 

Where the post-commit.tweet script is the script from fooobar.com/questions/299292 / .... If you also don’t tweet your commits, you can delete this line.

If you want this to work for every Git repository now, add these scripts to your git-core templates. You must find out where they are (this is different for each setting). For my Mac, they are located here: /opt/local/share/git-core/templates/hooks/post-commit .

+4
source

Source: https://habr.com/ru/post/1487340/


All Articles