I'm trying to make my first commit on a new pre-existing project. My branch is up to date but when I try to make a commit I get this message:
Changes not staged for commit:
modified: src/components/router/********
no changes added to commit
Note, I have not performed git add
. Is that something you need to do?
答案 0 :(得分:1)
You must add the files to the index (git add
) before committing them (git commit
). As per the git commit
docs:
Stores the current contents of the index in a new commit along with a log message from the user describing the changes.
The only exception would be to list the files in the git commit
command directly with -a
or --interactive
or --patch
option.
答案 1 :(得分:0)
Yes, for example if you create a new file you have to add the files to git with git add. After that you can use git commit and git push.