#!/bin/sh1#2# create_patch.sh - Creates an enhancement patch based on the current Git changes3#45if [ "$#" -ne 1 ]6then7echo "Usage: $0 patch_file"8echo ' Creates a patch file based on the changes made to the current directory'9exit 110fi1112# Make sure this is a git repository13if [ ! -d .git ]14then15echo 'Error: The current directory is not a Git repository.'16exit 117fi1819# 'git diff' is stupid and doesn't show new untracked files, so we must add them first.20git add .21# Generate the patch.22git diff -p --staged > "$1"23# Undo the 'git add'.24git reset252627