Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git stash throws error No local changes to save [duplicate]

Tags:

git

I have added a new file to my local branch. On running the command git status it gives below output:

# On branch MyLocBranch
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   mypath/nextDir/myfile.py
nothing added to commit but untracked files present (use "git add" to track)

This is fine as I have untracked file and it shows in red in the terminal.

Now to stash this changes, I ran the commands git stash and git stash save "some message". But I get the error No local changes to save which is weird. The changes should have been stashed.

like image 565
Deca Avatar asked Jul 05 '16 10:07

Deca


1 Answers

By default git stash doesn't save untracked files.

In order to also stash your untracked files, you can use the --include-untracked (or -u) option.

like image 115
Matt Avatar answered Oct 15 '22 10:10

Matt