Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add line break to git commit -m from command line on Windows

Tags:

git

windows

My company has a policy that all checkins to a particular project must follow a specific multi-line template for git commits. How can I most simply create a single commit message that has multiple lines from the command line in Windows?

This is almost exactly a duplicate of "Add line break to git commit -m from command line" except that this question is specific to Windows/cmd.exe, while that question is related to bash.

like image 771
Phrogz Avatar asked Feb 25 '13 20:02

Phrogz


1 Answers

Either create a file that contains your commit message in the right format and use git commit -F <message_file>, after which you can continually edit and reuse that same file, or create a template file and use git commit -t <template_file> to open your editor with the pre-cooked template to be filled in. The second option can be made permanent by setting the commit.template configuration variable, so you don't need to use the -t ... bit on every commit. See the git commit manual page (git help commit, if your git is installed correctly, or search online) for more information.

like image 84
twalberg Avatar answered Sep 19 '22 18:09

twalberg