0

is it possible to do a git commit and when the editor opens it is already filled with a message to be edited?

example:

git commit "some string"

would open the text editor with "some string" that could be edited.

Use case: I have a git alias to commit work in progress (end of the day for instance) git commit -m ":construction: WIP" (yes, I use emojis on some commit messages), but I would like to add some extra details sometimes.

For the git documentation there's:

  • the --message flag but doesn't open the editor
  • the --template=<file> but it uses a message template from a file

Any solutions?

pedrorijo91
  • 7,635
  • 9
  • 44
  • 82

1 Answers1

3

Use the -e|--edit option to allow manual editing even when you provide a message on the command line:

$ git commit -em ":construction: WIP"

This and many other options are described in the documentation

Useless
  • 64,155
  • 6
  • 88
  • 132