It's a solved problem. Commits can be represented as e-mails. (e.g. "git format-patch").
The mails can be catenated together into one file; this is called the mbox format.
Get three commits as three separate files:
$ git checkout
Your branch is up to date with 'origin/master'.
$ git format-patch HEAD~3
0001-Issue-successful-status-out-of-cdlog.recover.patch
0002-cdalias-take-zero-one-or-two-args.patch
0003-cdunalias-improve-test-for-undefined-alias.patch
Now checkout to before those commits, detaching HEAD:
$ git checkout HEAD~3
Note: checking out 'HEAD~3'.
You are in 'detached HEAD' state.
HEAD is now at b3c0288 New feature: auto recovery.
Now, catenate those files together to create one "patch.mbox" file:
$ cat 000* > patch.mbox
"git am" takes the whole file and applies it:
$ git am patch.mbox
Applying: Issue successful status out of cdlog.recover.
Applying: cdalias: take zero, one or two args.
Applying: cdunalias: improve test for undefined alias.
Clean up: return to master, delete the file:
$ git checkout master
Warning: you are leaving 3 commits behind, not connected to
any of your branches:
[ .... ]
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
$ rm patch.mbox
It's a solved problem. Commits can be represented as e-mails. (e.g. "git format-patch").
The mails can be catenated together into one file; this is called the mbox format.
Get three commits as three separate files:
Now checkout to before those commits, detaching HEAD: Now, catenate those files together to create one "patch.mbox" file: "git am" takes the whole file and applies it: Clean up: return to master, delete the file: