When you run git commit without the -m flag.... git does all of these things for you:
- Generates some content based on the current state of the working dir to display in your editor, with a
#prefix on each line, as this info shouldn't go into be in the commit message when you exit your editor - Saves this generated content to a file named
COMMIT_EDITMSG - Opens your
$EDITORwith theCOMMIT_EDITMSGfile - When you exit your editor, it immediately commits
Is there a command that simply only does:
- #1 above
- And then prints that text content to
STDOUT-or- writes it to a custom filename that I specify - ...but does nothing else?
I guess there's the option to just run git status and write some text transformation code to insert the # prefixes etc... but if there's just a simple command that does exactly #1 for me, in the exact same format as git commit would have done it, that would be cool.
I need to be able to do this on both Windows + Linux.
You can "trick"
git-committo do it for you: