Git command to Unstage Staged files

Sometimes we will forgot add some changes to the files and we will stage those files and then we reliase that we need to add some missing part to that file, but staged file can't allow to add changes. so you have to unstage it and add your changes and stage it.  Here are the git commands to unstage once staged files.

Git Unstage specific Staged file

//syntax
git restore --staged fileName

// example command
git restore --staged myWorkspace/classes/sampleFile.cls

Git Unstage All Staged files

// unstage all files 
git restore --staged .

Flags:

  • Dot(.) : Dot represent all files 
Labels:
Git
Join the conversation