Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
modified: src/index.js
This isn’t an error — Git is telling you that you have changes that haven’t been staged (added) for the next commit.
Fix: Stage your changes
# Stage specific files
git add src/index.js
# Stage all changes
git add -A
# Then commit
git commit -m "Update index.js"
Understanding the Git workflow
Working Directory → Staging Area → Repository
(edit files) (git add) (git commit)
- You edit files — they show as “not staged”
git addmoves them to staging — they show as “to be committed”git commitsaves them permanently
Common situations
You want to commit everything:
git add -A && git commit -m "my changes"
You want to commit only some files:
git add src/index.js src/utils.js
git commit -m "update specific files"
You want to undo changes (discard edits):
git checkout -- src/index.js # Discard changes to one file
git checkout -- . # Discard all changes
You want to stash changes for later:
git stash # Save changes, clean working directory
git stash pop # Restore them later
See also: Git cheat sheet | Git stash cheat sheet