Play fanfare after triumphing over
This is heavily inspired by @DanaDanger's
- Plays fanfare on resolution of
- Doesn't play fanfare on trivial merge (i.e. no conflicts/conflicts automatically resolved)
- Cross-platform support on GNU/Linux and OS X
- Play custom fanfare
- Support for
- MailChimp newsletter to receive updates
Before we get to the fun part (runnning this), we should cover what's going on and the reprecussions. We are using a setting in
git known as
init.templatedir. As the name implies, this is a folder that is used to initialize all future
We are overriding the entire
.git/hooks folder default (typically full of samples). As a result, we will also be conflicting with per-repo hooks (e.g. some teams like to enforce linting on each commit). So here is your warning:
victorious-git adjusts with your
.git/hooks folder for all future repositories.
Please take caution and be aware that this will adjust future
.git/hooks interactions, such as before/after commits occur.
One line install
The following installs
~/.config/victorious-git and sets up a user-wide
(cd /tmp/ && (test -d victorious-git || git clone --depth 1 https://github.com/twolfson/victorious-git) && cd victorious-git/ && bin/install.sh)
By default, we will play the Final Fantasy VI fanfare.
Alternative sounds can be downloaded during installation via
VICTORIOUS_GIT_MUSIC_URL. Here's an example with The Legend of Zelda's item get:
export VICTORIOUS_GIT_MUSIC_URL="http://www.myinstants.com/media/sounds/139-item-catch.mp3" (cd /tmp/ && (test -d victorious-git || git clone --depth 1 https://github.com/twolfson/victorious-git) && cd victorious-git/ && bin/install.sh)
If you would like to update an existing installation's sounds, please see the Music section.
Feeling uncertain about installing
victorious-git? Give it a test drive. The following script will set up a temporary
git directory using
--template (no global installation):
(cd /tmp/ && (test -d victorious-git || git clone --depth 1 https://github.com/twolfson/victorious-git) && cd victorious-git/ && bin/test-drive.sh) # Creates new git repo at `/tmp/victorious-git-demo/` # Sets up branches ready to be conflicts # Outputs commands to let you pull the switch (e.g. `git merge`, `git commit`)
By using symlinks, we can retroactively apply changes to
victorious-git bound repositories (e.g. upgrades, changing music).
This is very dangerous because it effectively makes all
.git repositories share the same
hooks/ folder. This means adding a hook in
~/repo1/.git/hooks/prepare-commit-msg will add the hook to
# Navigate to a temporary location cd /tmp/ # Clone our repository git clone --depth 1 https://github.com/twolfson/victorious-git cd victorious-git/ # Run our symlink install script bin/install-symlink.sh
victorious-git to existing repositories
victorious-git in existing
git repositories, we can use the following commands:
# Inside of our repository (e.g. `victorious-git`) # Delete our existing `git` hooks rm -r .git/hooks/ # Reinitialize the repository (leverages template directory) # This will not destroy `git` history git init # Proof that hooks are installed ls .git/hooks/
Upon installation, you should hear our sound play once. You can listen to the current sound via:
If you would like to update the installed music, this can be done via:
music_url="http://www.myinstants.com/media/sounds/139-item-catch.mp3" wget "$music_url" --output-document ~/.config/victorious-git/dotgit/hooks/victory.mp3
victorious-git attempts to use
afplay and falls back to
mplayer for its music playback. To determine if you are using
# This will have output if we are using `afplay` which afplay
afplay is being used, its volume can be set via
VICTORIOUS_GIT_VOLUME. By default, this is 5.
export VICTORIOUS_GIT_VOLUME=10 # Adjusts our `afplay -v 5` to `afplay -v 10`
To set this permanently for your user, it can be added to your
~/.bashrc. This includes
fish/etc users as all our scripts invoke
bash via a shebang (
echo "export VICTORIOUS_GIT_VOLUME=10" >> ~/.bashrc
We strongly recommend performing all development via
tests. It becomes cumbersome to setup and re-setup different
git scenarios without them.
Here are some common techniques:
If you would like to inspect the state of a test fixture (e.g. a debugger), then you can place an
exit as well as echo out the
If you would like to compare different states of
git folders, then run
ls against the respective folders you want to inspect (e.g.
If you would like to see which
git hooks run in a scenario, then add in all possible variations with an
echo and see which ones run.
Tests can be run via the following command:
By default, we disable
test/install.sh which runs installation tests as the current user. That test suite has the potential to destroy existing setups.
To run the install test, use the
TEST_INSTALL environment variable:
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. See the Testing section on how to run tests.
This project is inspired by @DanaDanger's
The linked sound clips are not owned, hosted, nor licensed by this repository. By downloading them, you are agreeing that they are exclusively for personal use and the maintainers of this repository are not legally responsible for any consequences.
As of Jul 21 2015, Todd Wolfson has released this repository and its contents to the public domain.
It has been released under the UNLICENSE.