Discard Unstagged Changes In Git?

This tutorial will shows you that how you can discard changes unstage a single file or multiple files and how you can easily unstage files in your current working tree.

 

To discard unstage file use the following command 

git restore somefile.php 

To discard all un stage files use the following command 

git restore . 

to unstage some staged file use the following command.

git restore --staged somefile.php

 

Following command help you to keep record of your current files using git stash and this command will also discard all unstages files.

git stash save --keep-index --include-untracked

 


Tags:

git

Share:

Related posts