Skip to content

Instantly share code, notes, and snippets.

@artynet
Last active November 10, 2020 09:48
Show Gist options
  • Save artynet/a819533a32b6ac3bcde158ea5ba2a1b6 to your computer and use it in GitHub Desktop.
Save artynet/a819533a32b6ac3bcde158ea5ba2a1b6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# URL : https://stackoverflow.com/questions/48400287/git-format-patch-for-all-the-commits-to-a-file
COUNTER=${2};
for c in `git log --format="%H" -- ${1} | head -n ${2}`;do
git format-patch --start-number=$COUNTER "$c^1".."$c" -o patches
let COUNTER=COUNTER-1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment