What does “Changes not staged for commit” mean

前端 未结 9 1974
再見小時候
再見小時候 2021-01-29 17:17

I thought if you want to track the files you should git add [files you want to track]

I don\'t know why I got the messages Changes not staged for com

9条回答
  •  有刺的猬
    2021-01-29 18:07

    Suposed you saved a new file changes. (navbar.component.html for example)

    Run:

    ng status
    modified:   src/app/components/shared/navbar/navbar.component.html
    

    If you want to upload those changes for that file you must run:

    git add src/app/components/shared/navbar/navbar.component.html
    

    And then:

    git commit src/app/components/shared/navbar/navbar.component.html -m "new navbar changes and fixes"
    

    And then:

    git push origin [your branch name, usually "master"]
    

    ---------------------------------------------------------------

    Or if you want to upload all your changes (several/all files):

    git commit -a
    

    And them this will appear "Please enter the commit message for your changes."

    • You'll see this message if you git commit without a message (-m)
    • You can get out of it with two steps:
    • 1.a. Type a multi-line message to move foward with the commit.
    • 1.b. Leave blank to abort the commit.
      1. Hit "esc" then type ":wq" and hit enter to save your choice. Viola!

    And then:

    git push
    

    And Viola!

提交回复
热议问题