Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading