Skip to content
/ wit Public

šŸ§  An initial commit message generator as a git hook.

License

Notifications You must be signed in to change notification settings

cedricium/wit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ā 

History

9 Commits
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Repository files navigation

wit Ā· GitHub GitHub

An initial commit message generator as a git hook.

The ā€œinitial commitā€ message as a first commit in many repos is quite boring (personally speaking of course). Since that initial commit message conveys very little valuable information to begin with, developers should have a chance to have some fun with that first message. Thinking of a clever message can be hard however, so thatā€™s where wit comes in.

With a collection of funny, clever, and witty messages (brought to you by the many contributors of ngerakines/commitment), wit automatically fills out your first commit message in any newly-created git repository.

Super cute raccoon illustration by Lauren Pettapiece, https://www.laurenpettapiece.com/

How Does it Work?

The bread and butter of wit lies in the .git_templates/hooks/prepare-commit-msg file. This is a standard git hook, whose function is described as:

"The prepare-commit-msg hook is run before the commit message editor is fired up but after the default message is created. It lets you edit the default message before the commit author sees it."

In order to achieve witty first commit messages, the prepare-commit-msg hook first checks to ensure there are zero (0) commits throughout the entire git repo. If thatā€™s true, then the hook simply replaces the first line of the commit template message (either the default git message or whatever is set under the git commit.template config variable) with a random line from this list of messages.

Getting Started

Prerequisites

Note: wit works best on Linux and macOS.

  • curl or wget should be installed
  • git should be installed

Installation

Wit is installed by running one of the following commands in your terminal. You can install this via the command-line with either curl or wget.

via curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/cedricium/wit/master/scripts/install.sh)"

via wget

sh -c "$(wget https://raw.githubusercontent.com/cedricium/wit/master/scripts/install.sh -O -)"

Using wit

Adding / Removing Commit Messages

The list of commit messages used by wit can be found at: $HOME/.wit/res/commit_messages.txt Feel free to add or remove any lines you see fit, ensuring there are no empty lines in the file.

Uninstalling wit

Although we're sad to see you go, uninstalling wit is a straight-forward process. Just run:

$ sh ~/.wit/scripts/uninstall.sh

Alternatively, you can wrap the above code in a function and add it to the end of your shell's run commands file (bash: .bashrc or .bash_profile, zsh: .zshrc):

function uninstall_wit() {
  sh ~/.wit/scripts/uninstall.sh
}

Then you can use uninstall_wit from the command-line to initiate the uninstall process.

Contributing

Your contributions are always welcome! See an issue you want to tackle or have an idea for a feature you'd like implemented? Just open a pull-request with a short explanation of the changes and I'd be happy to review it.

Refer to this project's contributing guidelines to better understand what's expected as a contributing member.

License

Wit released under the MIT License.

About

šŸ§  An initial commit message generator as a git hook.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages