Skip to content

Instantly share code, notes, and snippets.

@clifferson
Created August 25, 2025 17:55
Show Gist options
  • Save clifferson/9f40117f1b440562fb120268558b0c87 to your computer and use it in GitHub Desktop.
Save clifferson/9f40117f1b440562fb120268558b0c87 to your computer and use it in GitHub Desktop.
#!/bin/bash
# A simple script to add all changes, commit with a custom message, and push to the remote repository.
# Check if a commit message was provided as a command-line argument.
if [ -z "$1" ]; then
echo "Error: Please provide a commit message."
echo "Usage: ./git-commit-all.sh \"Your commit message here\""
exit 1
fi
# Add all files to the staging area.
echo "Staging all changes..."
git add .
# Commit the changes with the provided message.
echo "Committing with message: '$1'..."
git commit -m "$1"
# Push the changes to the remote repository.
echo "Pushing changes to remote repository..."
git push
echo "Operation complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment