git staged changes code example
Example 1: How do I show the changes which have been staged
git diff --staged # or you can use --cached (they are synoyms, see the source)
Example 2: git add
//to add a single file
git add <FILE_NAME>
//to add all changed files
git add -A
Example 3: git discard staged changes
git reset HEAD
git checkout .
Example 4: git check staged changes
git diff --cached
Example 5: git stage
git add . (This stages all changes made in the repository)
git add <filename> (Stages the change made in the specific filename)