git-pub is a bash script that simplifies the formatting and management of Git commits. The script guides the user through several prompts to collect the necessary information and automatically generates a formatted commit with the type, task number, title, and an optional body.
- Prompts the user to specify the commit type (FIX, UPDATE, ADD, PARTIAL).
- Allows optional input for a task number.
- Requires a commit title.
- Allows an optional commit body.
- Uses icons based on the commit type:
FIX: 🔧UPDATE: 🔄ADD: ➕PARTIAL: ✳️
- Executes
git add,git commit, andgit pushin sequence, handling any errors.
-
Place the
git-pubfile in the~/bindirectory or any directory of your choice. -
Ensure that the directory where you saved the script is included in your
$PATH. To do this, add the following line to your.bashrc,.bash_profile, or.zshrcfile (depending on your shell):export PATH="$HOME/bin:$PATH"
Then, run
source ~/.bashrc(or the corresponding file for your shell) to apply the changes. -
Make the script executable by running:
chmod +x ~/bin/git-pub -
Use the script by running the
git pubcommand in the Git repository directory where you want to make the commit. -
Follow the prompts to enter the required information for the commit.
Here's an example of how to use git-pub to make a commit:
-
Run
git pubin the Git repository directory. -
Enter the commit type (e.g.,
FIX). -
Enter the task number (optional).
-
Enter the commit title.
-
Enter the commit body (optional).
-
The script will automatically run
git add,git commit, andgit push.
- Make sure you have Git configured with your username and email before using the script.
- The script is designed to work on Unix-like systems with Bash. It may not work correctly on Windows or with other shells.
With git pub, you can streamline the process of creating and formatting commits in Git, ensuring greater consistency and clarity in your commit messages. Try using this script to enhance your versioning experience with Git!