Protect yourself from accidentally pushing to a remote repository while learning new words.

Do your work and make commits. When you're ready, push your commits to your remote repository.

You will be prompted to enter a random word before the commit will be pushed.

Enter the word correctly and your code gets pushed to the remote repository.

Download Git Literate

How to use Git Literate

  • Download git-literate.pre-push.sh.
  • Put the file in .git/hooks/ in your projects repository.
  • Rename the file to 'pre-push' (no extension).

That's it! Try pushing to a remote repository and you will see a prompt to retype a random word. Type the word correctly and your commits are pushed to the remote repository. Get it wrong and the push is aborted. While you're at it, why not look the word up if you don't know it. It's like word-a-day toilet paper, but way cooler!


Awesome script modifications

Limit verification to a specific remote

Although not used in the main script there is a second variable passed to the pre-push script when it is run. This is the url of the remote repository you are pushing to. If you only want to limit the use of Git Literate to one remote repository, production for instance, wrap the read and exit lines like so:

if [[ "$2" == "git@your-remote.here:your-project.git" ]]
then
    read...
    exit...
fi

Have your own modification?

I'd love to see it and add it to the collection! Fork the project, add your file (e.g. specific-url.pre-push.sh) to the modifications folder, and submit a pull request.


Cool modifications I'd like to see

  • Adding a definition before prompting you to enter the word
  • Multi-word check
  • Git-Math-Literate (simple math check)