-3

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?

ErikMD
  • 13,377
  • 3
  • 35
  • 71
Mshark
  • 209
  • 2
  • 3
  • 7

2 Answers2

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.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
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.

tdev
  • 136
  • 4