-
-
Save yousefhamza/4dd09baa0ef0b456366a to your computer and use it in GitHub Desktop.
This is a simple shell script to extract commits by a specified author in a git repository and format them as numbered patches. It is useful for GSoC code submission.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ! [[ $# -eq 1 || $# -eq 2 || $# -eq 4 ]]; then | |
echo "Usage: $0 <author> [<start_date> <end_date>] [output_dir]" | |
echo "Example: $0 [email protected] 2015-05-25 2015-08-21 ./patches" | |
exit | |
fi | |
author=$1 | |
if [ $# -gt 3 ]; then | |
output_dir=$4 | |
elif [ $# -eq 2 ]; then | |
output_dir=$2 | |
else | |
output_dir="./" | |
fi | |
if [ $# -gt 2 ]; then | |
start=$2 | |
end=$3 | |
else | |
start="2015-05-25" | |
end="2015-08-21" | |
fi | |
counter=0 | |
for i in `git log --author="$author" --since=$start --until=$end --pretty=oneline | sed 's/ .*//' | tail -r` | |
do | |
counter=$((counter+1)) | |
git format-patch -M -C -1 --start-number $counter $i -o $output_dir | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment