Home > Net >  How do i restore from staged into working directory
How do i restore from staged into working directory

Time:01-12

How do i restore from staged into working directory? in other words i want the working directory to look like how it did after my last git add.

This is what i did:

  1. git add foo.md
  2. edit edit edit(no add, nothing)

How do i go back to how my working directory looked just after number 1?

I have tried doing git stash then git stash pop --index but it seems to bring back edits that weren't staged. and at that point i would probably just commit and then reset. Is there a command though, to just bring back my staged?

CodePudding user response:

To retrieve state of path/to/file from index use git restore path/to/file.

See manual page of git-restore for details and other options.

  •  Tags:  
  • git
  • Related