Skip to content

Instantly share code, notes, and snippets.

@juan-medina
Last active January 18, 2025 20:35
Show Gist options
  • Select an option

  • Save juan-medina/1713269669a921a12e40fb358d803b2e to your computer and use it in GitHub Desktop.

Select an option

Save juan-medina/1713269669a921a12e40fb358d803b2e to your computer and use it in GitHub Desktop.
#!/bin/bash
branch1=$1
branch2=$2
diff=$(git diff $branch1 $branch2)
commitMessage=$(cat <<EOF
Generate a git commit message in the following format:
- First line with a summary of the changes (max 50 characters)
- Up to 10 lines describing the changes in detail (max 100 characters each)
- Output the format as code for easy copy-paste, including line breaks
The git diff between $branch1 and $branch2 is:
$diff
EOF
)
echo "$commitMessage" | pbcopy
echo "Commit message copied to clipboard."
#!/bin/bash
diff=$(git diff)
commitMessage=$(cat <<EOF
Generate a git commit message in the following format:
- First line with a summary of the changes (max 50 characters)
- Up to 10 lines describing the changes in detail (max 100 characters each)
- Output the format as code for easy copy-paste, including line breaks
The git diff is:
$diff
EOF
)
echo "$commitMessage" | pbcopy
echo "Commit message copied to clipboard."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment