How to fix No local changes to save in Git
This message appears when running git stash but Git finds no modified tracked files in your working directory. It typically occurs when you have only untracked files, or your working directory is already clean.
Quick fix
Fixes No local changes to save
git status- Check your current Git status
- Include untracked files in the stash
- Stage files before stashing
- Include ignored files as well
git statusNo local changes to save
What this error means
When Git displays "No local changes to save," it means the stash command found nothing to stash. By default, `git stash` only saves changes to files that Git is already tracking (files that have been previously committed or staged). This is not an error in the traditional sense—it is informational feedback. Git is telling you that your working directory has no modifications to tracked files that need to be temporarily stored. The most common scenario is when you have created new files but haven't staged them yet. These untracked files are invisible to the default stash operation. Similarly, if you already committed or stashed all your changes, your working directory will be clean and there will be nothing left to stash.
Typical symptoms
- Running git stash returns "No local changes to save" instead of creating a stash entry
- git stash list shows no new stash was created
- You have new files in your directory but git stash ignores them
- git status shows untracked files but stash says no changes to save
Common causes
- Working directory is clean with no modifications to tracked files
- You have only untracked files (new files not yet added to Git)
- Changes were already committed before attempting to stash
- Changes were already stashed previously
- You are in a subdirectory and there are no changes in that path
How to fix "No local changes to save"
First, verify what Git sees in your working directory:
git statusIf the output shows "nothing to commit, working tree clean," your directory truly has no changes to stash. If you see files listed under "Untracked files," those are the files being ignored by the default stash command.
To stash untracked files (new files you haven't added yet), use the -u or --include-untracked flag:
git stash -u
# or
git stash --include-untrackedThis tells Git to also stash files that are not yet tracked.
Alternatively, you can stage your new files first, then stash:
git add .
git stashOnce files are staged, they are considered "changes" that git stash will pick up.
If you also need to stash files that are in your .gitignore, use the -a or --all flag:
git stash -a
# or
git stash --allThis stashes tracked changes, untracked files, AND ignored files. Use with caution as it may include build artifacts or dependencies.
After running the appropriate stash command, confirm it worked:
git stash listYou should see an entry like stash@{0}: WIP on main: abc1234 Your last commit message.
Advanced notes
### Understanding Git Stash Behavior
The stash command creates a commit-like object that stores your working directory state. By default, it only considers:
- Modified tracked files (changes not yet staged)
- Staged changes (in the index)
It explicitly excludes:
- Untracked files (unless -u is used)
- Ignored files (unless -a is used)
### Stash with a Message
When stashing, it helps to add a descriptive message:
git stash push -u -m "WIP: feature X before switching branches"### Partial Stashing
You can stash specific files only:
git stash push -u path/to/file.js another/file.ts### Scripting Considerations
If you are writing scripts that use git stash, check the exit code. Git returns exit code 0 even when "No local changes to save" is printed. To detect this programmatically, check if a new stash was created by comparing git stash list before and after, or use git stash push and check if the stash ref changed.
Frequently asked questions
- What does "No local changes to save" mean?
- When Git displays "No local changes to save," it means the stash command found nothing to stash. By default, git stash only saves changes to files that Git is already tracking (files that have been previously committed or staged). This is not an error in the traditional sense—it is informational feedback.
- How do I fix "No local changes to save"?
- This message appears when running git stash but Git finds no modified tracked files in your working directory. It typically occurs when you have only untracked files, or your working directory is already clean.
- What causes "No local changes to save"?
- Working directory is clean with no modifications to tracked files You have only untracked files (new files not yet added to Git) Changes were already committed before attempting to stash
- Is the "No local changes to save" error serious?
- It is a low-severity error — more of a blocker than a risk. The steps above resolve it.