

When " git restore -staged " removes a path that's in the index, it marks the entry with CE_REMOVE, but we don't do anything to invalidate the cache-tree. (Merged by Junio C Hamano - gitster - in commit 09e393d, ) restore: invalidate cache-tree when removing entries with -staged See commit e701bab () by Jeff King ( peff). 2020), " git restore -staged" did not correctly update the cache-tree structure, resulting in bogus trees to be written afterwards, which has been corrected. Or the short form which is more practical but less readable: git restore -SW hello.c Or you can restore both the index and the working tree (this the same as using git-checkout) git restore -source=HEAD -staged -worktree hello.c To restore a file in the index to match the version in HEAD (this is the same as using git-reset) git restore -staged hello.c Git reset can also be used to restore the index, overlapping with git restore.

This operation changes the commit history.
#GIT STASH RESTORE HOW TO#
I have presented git restore (which is still marked as "experimental") in " How to reset all files from working directory but not from staging area?", with the recent Git 2.23 (August 2019).
