Skip to content

Instantly share code, notes, and snippets.

@jeenuv
Created October 21, 2014 08:38
Show Gist options
  • Select an option

  • Save jeenuv/778283cdd0349cae83dc to your computer and use it in GitHub Desktop.

Select an option

Save jeenuv/778283cdd0349cae83dc to your computer and use it in GitHub Desktop.
Export selected patches to numbered files
#!/bin/bash
# Receive a list of revisions from rev-list. For each revision, generate a file
# name from a commit subject, prefixed with a 4-digit count
#
# All this acrobatics only becuase format-patch refuses to generate a single
# patch witout a numbered suffix
git rev-list --reverse --left-only --no-merges --cherry-pick mainline/v3.17...github/juno-beta -- arch/arm64/{kernel,boot,mm} mm |
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment