git - What does "Changes not staged for commit" mean

ID : 10294

viewed : 7

Tags : gitgit

Top 5 Answer for git - What does "Changes not staged for commit" mean

vote vote


when you change a file which is already in the repository, you have to git add it again if you want it to be staged.

This allows you to commit only a subset of the changes you made since the last commit. For example, let's say you have file a, file b and file c. You modify file a and file b but the changes are very different in nature and you don't want all of them to be in one single commit. You issue

git add a git commit a -m "bugfix, in a" git add b git commit b -m "new feature, in b" 

As a side note, if you want to commit everything you can just type

git commit -a 

Hope it helps.

vote vote


You have to use git add to stage them, or they won't commit. Take it that it informs git which are the changes you want to commit.

git add -u :/ adds all modified file changes to the stage git add * :/ adds modified and any new files (that's not gitignore'ed) to the stage

vote vote


It's another way of Git telling you:

Hey, I see you made some changes to your files, but keep in mind that when you write pages to my history, those changes won't be in these pages.

Changes to files are not staged if you do not explicitly git add them (and this makes sense).

So when you git commit, those changes won't be added since they are not staged. If you want to commit them, you have to stage them first (ie. git add).

vote vote


Try following int git bash

1.git add -u :/

2.git commit -m "your commit message"

  1. git push -u origin master

Note:if you have not initialized your repo.

First of all

git init  

and follow above mentioned steps in order. This worked for me

vote vote


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


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!

Top 3 video Explaining git - What does "Changes not staged for commit" mean