Home > Software engineering >  What's the meaning of -m when doing git commit
What's the meaning of -m when doing git commit

Time:10-27

When I do a git commit, I would include a note proceeded by -m. I'm always wondering what exactly does -m mean. I know there are other similar type of notations used when doing command line stuff, such as -a, -b, and etc. What exactly does the slash line mean?

CodePudding user response:

The -m is a short option. Traditionally, options on Unix are introduced with a single dash for short options, or a double dash for long options. There can be both for the same argument, and in this case the corresponding long option for -m is --message.

That's because this option introduces a commit message. If you don't specify one on the command line, then Git will open an editor to prompt you to write one. Typically, since we want to write detailed commit messages explaining why we've made a change, it's less common to use the -m or --message options.

You can see the documentation for git commit by running git commit --help. On a Unix system, that will typically invoke man, which is the manual page reader, to show you the documentation for the command. On Windows, typically it opens an HTML page. If you're using man, you can also invoke it for commands itself, such as man man (to see the documentation for man itself) or man sh to see the documentation for the shell.

CodePudding user response:

Read document, before asking is the best way to learn.

git commit document

-m <msg>
--message=<msg>
Use the given <msg> as the commit message. If multiple -m options are given, their values are concatenated as separate paragraphs.
  •  Tags:  
  • git
  • Related