Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stashed files show up as unchanged in `git status` (git v.2.16.0)

I use git-for-windows v2.16.0 and encountered the following problem, which also was reported here:

I initially have a clean working state; Output of 'git status':

git status
On branch beta
nothing to commit, working tree clean

Then I make local changes. Output of git status:

git status
On branch beta
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   app/src/main/java/android_serialport_api/sample/Debug.java

no changes added to commit (use "git add" and/or "git commit -a")

Then I stash them with 'git stash':

git stash
Saved working directory and index state WIP on beta: 2fca403 working on the console

Now my working directory should be clean but the output of git status still reads:

git status
On branch beta
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   app/src/main/java/android_serialport_api/sample/Debug.java

no changes added to commit (use "git add" and/or "git commit -a")

Which leads to not being able to git checkout etc.

like image 700
Mode77 Avatar asked Jan 25 '18 17:01

Mode77


People also ask

How do you check if there stashed changes in git?

The Git stash list command will pull up a list of your repository's stashes. Git will display all of your stashes and a corresponding stash index. Now, if you wish to view the contents of a specific stash, you can run the Git stash show command followed by stash@ and the desired index.

How do I get my stashed changes back in git bash?

Retrieve Stashed Changes To retrieve changes out of the stash and apply them to the current branch you're on, you have two options: git stash apply STASH-NAME applies the changes and leaves a copy in the stash. git stash pop STASH-NAME applies the changes and removes the files from the stash.

Does git clean clear stash?

Finally, you may not want to stash some work or files in your working directory, but simply get rid of them; that's what the git clean command is for.


1 Answers

This is a known bug in Git for Windows and it is fixed in v2.16.0(3). Updating to a newer version will fix this bug.

Thanks to @choroba for pointing out the reported issue!

like image 106
Pieter Avatar answered Oct 04 '22 14:10

Pieter