search

Home  >  Q&A  >  body text

What's going on when git commit reports "Changes not staged for commit:"?

After modifying the code and submitting it via git commit, the log reported is as follows

deMacBook-Pro:cheatsheetcup yoo$ git commit -m"modified Cheatsheet.html"
On branch master
Changes not staged for commit:
    modified:   Python Cheatsheet.html

Untracked files:
    .DS_Store
    .idea/

no changes added to commit

Whether the content in the file Python Cheatsheet.html has been committed successfully

巴扎黑巴扎黑2806 days ago3265

reply all(7)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:31:34

    Have you git add

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-02 09:31:34

    git commit -am "modified Cheatsheet.html"

    -a 表示 add

    reply
    0
  • 怪我咯

    怪我咯2017-05-02 09:31:34

    Before executing commit, choose git add Cheatsheet.html or git add .

    Then git commit -m "modified Cheatsheet.html"

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-02 09:31:34

    Git is divided into workspace and repository. The workspace is your code, and the repository is the git record.
    Before modifications enter the repository, there is a temporary storage area also called an index, which is the area recorded after the git add operation. When committing, the records in the staging area are added to the version database. Your prompt says that staged has no content, which means you have not performed an add operation.
    See here for details http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013745374151782eb658c5a5ca454eaa451661275886c6000

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-02 09:31:34

    Use .gitignore to block the Untracked files that you don’t want to display. It won’t be good if they appear every time

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-02 09:31:34

    No git add

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-02 09:31:34

    git 这里有点特殊。要先加入到 staging area 的改动才会被 git commit 提交。同一个文件也可以 add 多次。不想addCan:

    git commit -m 'msg' <file>

    or

    git commit -m 'msg' -a

    reply
    0
  • Cancelreply