Day 23

A Bash Quick-Commit Alias

Unfortunately, you can't run this in the browser here

This is a shell script and must be run locally on a Unix-based system — it cannot run in the browser.

Save it as gq somewhere on your $PATH, run chmod +x gq, then use it as gq 'your commit message'.


Description


A Bash script that wraps the three most common git steps — stage all, commit, and confirm — into a single command. Pass the commit message as the first argument and gq handles the rest. If no message is provided it prints usage and exits cleanly.

View the source code


#!/bin/bash

message=$1

if [ -z "$message" ]; then
    echo "Usage: gq 'commit message here'"
    exit 1
else
    git add .
    git commit -m "$message"
    echo "Committing: $message"
fi

Previous Day  |  Next Day