Home > Blockchain >  How to move a file from the staging area to the working directory in Git?
How to move a file from the staging area to the working directory in Git?

Time:08-04

For example, I have a file called test1.txt in my local folder. I've added it to the staging area using git add -A. Now how can I move test1.txt from the staging area to the working directory?

CodePudding user response:

Use git restore --staged test1.txt to move back the file from stage area to working directory.

This command is also see, if you run git status and you have files in the staging area.

As example:

$ git status
On branch master
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
     modified:   test1.txt

If you are not familiar with the basic Git commands, have a look at this overall-picture:

enter image description here

  • Related