search

Home  >  Q&A  >  body text

git commit -a -m "..." The commit is empty

First use git to initialize the folder, then create a new file hello, and execute git commit -a -m "Add new file hello", but the submission was not successful, as follows:

git commit -am 'added new benchmarks'
位于分支 master

初始提交

未跟踪的文件:
    hello

提交为空,但是存在尚未跟踪的文件
为情所困为情所困2792 days ago1271

reply all(5)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-02 09:41:54

    -a is to submit all the files that have been added to the repository and modified

    -a commit all changed files

    For files that have been added to the repository and have been changed, you can use git commit -am "message". New files need to be added to the repository first.
    Also, don’t write the commit message content randomly, try to be as standardized as possible, you can refer to the Commit message writing reference - Ruan Yifeng

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-02 09:41:54

    Let’s first understand the concepts of Git workspace, staging area and repository
    Workspace: It is the directory you can see on your computer.
    Temporary storage area: In English it is called stage, or index. It is generally stored in the index file (.git/index) under the "git directory", so we sometimes call the temporary storage area the index (index).
    Repository: There is a hidden directory .git in the workspace. This is not the workspace, but the Git repository.

    1. After understanding the above, use git status to check the current status and which files (in the workspace or staging area or repository) have been modified

    2. Modified the files in the workspace, first use git add <file_nane> to add them to the staging area

    3. You need to add the files in the staging area to the repository, use git commit -m 'modified comments'

    4. If you need to submit to the remote warehouse, use git push <remote> <master>

    reply
    0
  • PHPz

    PHPz2017-05-02 09:41:54

    Because you need to add the file to git management first through git add <file_name>

    reply
    0
  • PHPz

    PHPz2017-05-02 09:41:54

    New files added after git init must first be git add before they can be included in the git repository management, otherwise the newly added files will be in an untracked state.

    reply
    0
  • 某草草

    某草草2017-05-02 09:41:54

    git status View unadded files
    git add file1 file2 Add files
    git commit -m "*" Submit

    reply
    0
  • Cancelreply