How to fix nothing to commit, working tree clean in Git

GitBEGINNERLOWUpdated Dec 6, 2025ยท 506 views

This Git status message indicates your working directory has no changes to commit. While not an error, it often confuses developers who expect to see modified files. The message means all tracked files match your last commit and there are no staged changes waiting to be committed.

Quick fix

Fixes nothing to commit, working tree clean

# Check the actual file modification time
ls -la filename.txt

# Or compare file contents directly
cat filename.txt
  1. Verify your files are saved
  2. Check if files are being ignored
  3. Check for assume-unchanged or skip-worktree flags
  4. Verify you're in the correct Git repository
git โ€” error
# Check the actual file modification time
ls -la filename.txt
# Or compare file contents directly
cat filename.txt
nothing to commit, working tree clean

What this error means

The message "nothing to commit, working tree clean" from `git status` indicates that your working directory is in sync with the HEAD commit. This means: 1. **No modified files**: All tracked files have the same content as in the last commit 2. **No staged changes**: Nothing has been added to the staging area with `git add` 3. **No untracked files** (that Git is configured to show): New files either don't exist or are being ignored This is Git's way of telling you that a `git commit` would have nothing to do. The "working tree" refers to all the files in your project directory that Git is tracking. While this message isn't an error, it often appears when developers expect to see changes. This happens when files were modified but not saved, when changes were already committed, when files are being ignored by `.gitignore`, or when Git isn't detecting changes due to configuration issues.

Typical symptoms

  • Running git status shows 'nothing to commit, working tree clean' but you made changes
  • Git commit fails with 'nothing to commit' even after editing files
  • IDE shows modified files but Git doesn't recognize them
  • New files you created don't appear in git status
  • Files modified in your editor aren't being tracked by Git
  • After saving files, git status still shows working tree clean
  • Changes made by teammates aren't showing up in your local status

Common causes

  1. Files were modified but not saved in your editor
  2. Changes were already staged and committed in a previous commit
  3. Modified files are listed in .gitignore and being ignored
  4. Files are marked with 'assume-unchanged' or 'skip-worktree' flag
  5. You're in the wrong directory or not in a Git repository
  6. File modifications only involve whitespace or line endings that Git normalizes
  7. Git's index cache is out of sync with the actual file system
  8. New files exist but haven't been added with git add

How to fix "nothing to commit, working tree clean"

1Verify your files are saved

The most common cause is that your editor hasn't saved the changes to disk. Git only sees changes that have been written to the file system.

bash
# Check the actual file modification time
ls -la filename.txt

# Or compare file contents directly
cat filename.txt

In your editor:
- Look for unsaved file indicators (dots, asterisks, or different colors in tabs)
- Press Ctrl+S (or Cmd+S on Mac) to save
- Check if "auto-save" is enabled and working
- Some editors have a "Save All" option (Ctrl+Shift+S)

After saving, run git status again.

2Check if files are being ignored

Files matching patterns in .gitignore won't appear in git status. This is intentional but can be confusing when you forget what's being ignored.

bash
# Show ignored files
git status --ignored

# Check if a specific file is ignored
git check-ignore -v filename.txt

# List all ignored files
git ls-files --ignored --exclude-standard

If your file is being ignored, either:

1. Remove it from .gitignore (if you want to track it):

bash
# Edit .gitignore and remove the matching pattern
nano .gitignore

2. Force add the ignored file (one-time override):

bash
git add -f path/to/ignored/file.txt
3Check for assume-unchanged or skip-worktree flags

Git allows marking files to be ignored even if they're tracked. This is often done for configuration files that have local modifications.

bash
# List files marked as assume-unchanged
git ls-files -v | grep "^[a-z]"

# List files marked as skip-worktree
git ls-files -v | grep "^S"

If your file appears in these lists, remove the flag:

bash
# Remove assume-unchanged flag
git update-index --no-assume-unchanged path/to/file.txt

# Remove skip-worktree flag
git update-index --no-skip-worktree path/to/file.txt

Now git status should show modifications to these files.

4Verify you're in the correct Git repository

Make sure you're in the right directory and that it's actually a Git repository.

bash
# Show the root of the current Git repository
git rev-parse --show-toplevel

# Confirm you're in a Git repository
git status
# If not in a repo, you'll see: "fatal: not a git repository"

# Show your current working directory
pwd

If you're in a subdirectory, Git will still work, but make sure your changed files are within this repository. You might have:
- Opened a different project folder
- Created files outside the repository root
- Multiple nested Git repositories

5Refresh Git's index cache

Sometimes Git's index (the cache of file states) gets out of sync with the actual files, especially after file system operations or when using network drives.

bash
# Refresh the index to match the file system
git update-index --refresh

# Force a full refresh
git update-index --really-refresh

# Or clear and rebuild the index
rm .git/index
git reset

Note: The last option (rm .git/index) is safe but will unstage any previously staged changes. Use it only if other methods don't work.

After refreshing, check status again:

bash
git status
6Check for line ending or whitespace issues

Git might be normalizing line endings or whitespace, making files appear unchanged even after edits.

bash
# Check your core.autocrlf setting
git config core.autocrlf

# Check if whitespace changes are being ignored
git config core.whitespace

To see differences including whitespace:

bash
# Show all differences, including whitespace
git diff --ignore-blank-lines

# Show differences with whitespace visible
git diff --ws-error-highlight=all

If line endings are the issue:

bash
# Disable autocrlf to see actual changes
git config core.autocrlf false

# Refresh the index
git update-index --refresh
7Add new or untracked files

If you created new files, they need to be explicitly added to Git. Untracked files won't cause "nothing to commit" but they also won't be committed.

bash
# Show untracked files
git status -u

# Add a specific file
git add newfile.txt

# Add all new files in the current directory
git add .

# Add all new files in the entire repository
git add -A

After adding, check status:

bash
git status
# Should now show "Changes to be committed"

Interactive add to review each file:

bash
git add -p
8Check if changes were already committed

You may have already committed your changes and forgotten about it.

bash
# View recent commits
git log --oneline -5

# See what was in the last commit
git show --stat HEAD

# Compare working directory to a specific commit
git diff HEAD~1

If your changes are in the last commit and you need to modify them:

bash
# Amend the last commit (if not pushed)
git commit --amend

# Or undo the last commit but keep changes staged
git reset --soft HEAD~1

Warning: Don't amend commits that have been pushed to a shared repository.

Advanced notes

Understanding Git's Three Trees:

Git manages three "trees" (collections of file contents):

1. Working Directory: The actual files on your disk
2. Staging Area (Index): Changes prepared for the next commit
3. HEAD: The last commit on the current branch

"Nothing to commit, working tree clean" means: Working Directory = Staging Area = HEAD. All three match perfectly.

The Git Index File:

Git maintains its knowledge of the working tree in .git/index. This binary file caches file stats (modification time, size, etc.) for performance. When git status runs, it compares the cached stats to actual files.

If the index becomes corrupted or stale:

bash
# View index contents
git ls-files --stage

# Completely rebuild the index
rm .git/index
git reset

File System Monitoring Issues:

On some systems (especially network drives, Docker volumes, or WSL), file system events may not propagate correctly:

bash
# Disable file system monitoring if causing issues
git config core.fsmonitor false

# Or in WSL specifically
git config core.fileMode false

Case Sensitivity:

Git can be case-sensitive or case-insensitive depending on configuration:

bash
# Check case sensitivity setting
git config core.ignoreCase

# On case-insensitive systems (Windows, macOS default)
# Renaming File.txt to file.txt might not register

To force Git to notice case-only renames:

bash
git mv File.txt temp.txt
git mv temp.txt file.txt

Sparse Checkout:

If you're using sparse checkout, files outside your cone won't appear:

bash
# Check sparse checkout status
git sparse-checkout list

# Disable sparse checkout to see everything
git sparse-checkout disable

Submodules:

Changes within submodules have their own Git status:

bash
# Check submodule status
git submodule status

# Enter submodule directory
cd path/to/submodule
git status

Changes in submodules won't show in the parent repo's "nothing to commit" message until they're committed within the submodule and the submodule reference is updated.

Git Attributes and Filters:

Custom clean/smudge filters in .gitattributes can transform file contents:

bash
# Check if file has attributes
git check-attr -a filename

# Disable filters temporarily
GIT_WORK_TREE=/tmp/test git checkout HEAD -- filename

Frequently asked questions

What does "nothing to commit, working tree clean" mean?
The message "nothing to commit, working tree clean" from git status indicates that your working directory is in sync with the HEAD commit. This means: 1. No modified files: All tracked files have the same content as in the last commit 2.
How do I fix "nothing to commit, working tree clean"?
This Git status message indicates your working directory has no changes to commit. While not an error, it often confuses developers who expect to see modified files. The message means all tracked files match your last commit and there are no staged changes waiting to be committed.
What causes "nothing to commit, working tree clean"?
Files were modified but not saved in your editor Changes were already staged and committed in a previous commit Modified files are listed in .gitignore and being ignored
Is the "nothing to commit, working tree clean" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading