In the blog post, Split a commit in two with Git, Emmanuel provides a super clear explanation of how to split an old commit into multiple commits, separating that commit into different commits, each with a subset of the files initially committed.
It took me a while before I could figure out how to apply this to the very last commit. Here’s the required git magic:
git log -n 1 > m
git reset HEAD^
git add …
git commit -m "First part"
git add …
git commit -m "Second part"
The differences are really to just skip the first and last rebase steps (don’t do an interactive rebase, and don’t continue that rebase when done.) This was probably obvious to the author of the more general instructions.
Note that before resetting HEAD to the previous commit, I collect the current commit message, under the assumption that portions of it will be used in either of the two (or more) new commit messages. If you don’t do that, you can fish it out of your history by looking at ‘git reflog’ to see what the message was before mucking around with HEAD.
All the sources for my book, Geometric Algebra for Electrical Engineers, are available on github. Theoretically, that means that instead of sending me an email when errors are found (and I’m sure there are many), you can simply fork the repo, fix the error to your satisfaction, and submit a merge request. I didn’t expect that to actually happen, but it did:
Tim Put gets the credit for the first direct non-Peeter contribution to the GAelectrodynamics repository.
April 19, 2018
batch, COBOL, dependencies, EBCDIC, editors, ftp, git, loadmodule, LzLabs, mainframe, make, PDS, PL/I, t3270
Once upon a time, in a land far from any modern developers, were languages named COBOL and PL/I, which generated programs that were consumed by a beast known as Mainframe. Developers for those languages compiled and linked their applications huddled around strange luminous green screens and piles of hole filled papers while chanting vaguely latin sounding incantations like “Om-padre-JCL-beget-loadmodule-pee-dee-ess.”
In these ancient times, version control tools like git were not available. There was no notion of makefiles, so compilation and link was a batch process, with no dependency tracking, and no parallelism. Developers used printf-style debugging, logging trace information to files. In order to keep the uninitiated from talking to the Mainframe, files were called datasets. In order to use graphical editors, developers had to repeatedly feed their source to the Mainframe using a slave named ftp, while praying that the evil demon EBCDIC-conversion didn’t mangle their work. The next day, they could go back and see if Mainframe accepted their offering.
[TO BE CONTINUED.]
Incidentally, as of a couple days ago, I’ve now been working for LzLabs for 2 years. My work is not yet released, nor announced, so I can’t discuss it here yet, but it can be summarized as really awesome. I’m still having lots of fun with my development work, even if I have to talk in languages that the beast understands.