Reputation: 2231
I've a specific list of revisions output by git rev-list
and now I wanted to generate one patch file for each of revision from that list. I thought of passing each of the revision to git format-patch -1
. But this generates the patch file named 0001-blah-blah.patch
. I don't want format-patch
to number a single patch for me; I'd just like it to generate blah-blah.patch
instead.
Is there a way to get this done using git format-patch
alone? Or is the only way to rename the file once the patch is generated?
Upvotes: 0
Views: 376
Reputation: 2231
I had to work it around using this snippet:
git rev-list ... |
xargs bash -c '
let "n = 0"
for sha; do
printf -v name "%04d-%s.patch" "$n" "$(git show -s --format=format:%f "$sha")"
git format-patch --stdout -1 "$sha" > "patches/$name"
let "n++"
done
' bash
Upvotes: 1