Skip to content

Nothing to Commit

Error message

                nothing to commit, working tree clean
              

Quick summary

You tried to commit, but there are no staged changes — your working tree matches the last commit.

Why this happens

  • You forgot to run git add before committing

  • You already committed these changes

  • You have no modified, staged, or untracked files

Minimal example

✗ Broken code
git commit -m "Update"  # nothing to commit, working tree clean
✓ Fixed code
git add .
git commit -m "Update"  # now succeeds

You must stage changes with git add before committing. Without staged changes, there is nothing to commit.

How to diagnose

  • Run git status to see if there are any changes to stage

  • Check if the files you expect are listed as modified or untracked

  • Verify you are on the correct branch

How to fix

  • Run git add <file> (or git add .) to stage changes before committing

  • If you already committed, check git log to verify

  • If you have no changes, there is nothing to fix — the message is informational

How to prevent

  • Always run git status before git commit to verify there are staged changes

  • Use git add and git commit in sequence

Related Resources

Related Glossary

Related Lessons

← Back to language