What does “git commit -vam ” accomplish?

后端 未结 3 668
执念已碎
执念已碎 2021-01-29 16:23

I would like to ask what does the command \"git commit -vam \"message\" \" accomplish, because I have seen no difference with the command \" git commit

相关标签:
3条回答
  • 2021-01-29 16:56

    -a -> -all Stage all files that have been modified or deleted

    -v -> --verbose Show the diff between your changes and HEAD

    -m --> --message Commit Message for your commit.

    The Man page for Git lists all of the arguments the git command can take, with a detailed description of their purpose: https://www.kernel.org/pub/software/scm/git/docs/

    You can also access this from any *nix system via man git

    0 讨论(0)
  • 2021-01-29 16:56

    As per the git-commit documentation, the "v" option causes the command to be verbose.
    The important change with "-vam" is that the "a" option make

    git add -u
    

    before git commit.

    0 讨论(0)
  • 2021-01-29 17:07

    As many tools from the Linux ecosystem, Git command line supports two kinds of options:

    • short options; they consist of a minus (-) followed by a single letter or digits; f.e. -v, -a, -m etc;
    • long options; they start with two minuses (--) that are followed by a word (letters and digits); f.e. --verbose, --add, --message etc;

    Both kinds of options can have values. The value of a short option follows the option after a space (e.g. -m subject). The value of a long option follows the option after an equal sign (e.g. --message=subject).

    Two or more short options can be combined into a single word after the minus sign. E.g. -vam is the same as -v -a -m. At most one of them can have a value; the option that has a value should be the last one in the word and the value follows it as usual (separated by a space).

    To summarize:

    git commit -vam "message"
    

    is the same as:

    git commit -v -a -m "message"
    

    which is the same as:

    git commit --verbose --add --message "message" 
    

    Read more about git commit and its options.


    N.B. git -commit (as you wrote it in the question) is not a valid Git command or option.

    $ git -commit
    Unknown option: -commit
    usage: git [--version] [--help] [-C <path>] [-c name=value]
               [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
               [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
               [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
               <command> [<args>]
    

    You can always get help about Git by running git help on your command prompt. To get help about a specific Git command (commit, f.e.) run git help <command> (replace <command> with the actual command name, f.e. git help commit).

    0 讨论(0)
提交回复
热议问题