search

Home  >  Q&A  >  body text

About GIT commit operation issues

When both the disk (local file) and cache area are modified, as shown below:


Using: git commit -m 'xxx' will commit the cache area modifications, but the local modifications will not be submitted.
When using git commit -m 'xxxx' a.php, both the cache area and local modifications are submitted.
Is this the correct git principle? Ask God to explain.

天蓬老师天蓬老师2773 days ago668

reply all(3)I'll reply

  • 習慣沉默

    習慣沉默2017-05-02 09:36:50

    You can’t submit it like this! After executiongit commit -m '提交日志',肯定要执行一下git push origin 分支才能更新到对应的远程分支。git commit -m '提交日志'It is useless to add modified files afterwards

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-02 09:36:50

    That's right, git commit -m 'xxx' will only submit updates to files that have been added by git to the staging area, and in batches, that is, all files in the staging area will be submitted

    git commit -m 'xxx' a.php, the specified file can be submitted without git add, but only one. If you want multiple files, you must append the complete file names one by one after the command

    So if I want to commit all the modified files, but there is no git add to the staging area, I will use this command git commit -am 'x'

    reply
    0
  • ringa_lee

    ringa_lee2017-05-02 09:36:50

    When files are given on the command line, the command commits the contents of the named files, without recording the changes already staged. The contents of these files are also staged for the next commit on top of what have been staged before.

    Your understanding is correct. Finally, carrying the file parameters will directly commit the current contents of these files instead of the changes in the buffer.

    reply
    0
  • Cancelreply