How to unstage a file in git-git reset HEAD filename

How to unstage a file in git-git reset HEAD filename

Sometime you mistakenly added files to staging so if you want to revert it back you can use this command

       git      reset      HEAD     <filename>

this command remove the files from staging and those files will be added working directory or unstage the files.

and it will not remove any changes or modifications from files.

git reset head filename

in the image you can see I added two files devops1.txt and devops2.txt   to staging

and I reverted it back.

So this command is used to move files from staging to working directory or to unstage the files

git unstage all staged files

after adding the files to staging area, if you want to revert it back or to unstage all files from staging  use below command

git reset HEAD .

 

  • git remove file from add list
  • git remove staged changes
  • unstage git add
  • git unstage file
  • git unstage all staged files
  • unstage after git add
  • git unstage file
  • unstage from git add
  • git unstage all staged files
  • how to remove files from git add
  • git remove file from staging
  • unstage all files git
  • git undo staged changes

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *