Delete one or more modified files in the working directory

$ git checkout -- <The file name to be discard the change>

The above command will delete all the changes you have added to that file.

The above command only applies to files that are not in the staging area.

Move one or more files from the Staging area to the Working directory

In fact, after you do git add to add files and staging areas, but you feel uncomfortable and want to move those files back to the working directory.

You can do the following:

$ git reset <file name>

Edit and manipulate committed files

There are 3 options for us:

- Git reset --soft

- Git reset --mixed

- Git reset --hard

For example:

$ Git reset --soft 7d6fe403d0ec58ed1add3076bb7f9197717c27ca

The above command will redirect the commit with the above id to staging area status.

The same goes for --mixed and --hard which will return the commit to the staging area or delete the commit as well.

Note when using --hard if not careful will lose data.

This part pauses here.

I wish you happy learning.

Keywords: Git