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.
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.
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.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With