Last Updated on January 30, 2021 by sandeeppote

Before this if you want to see Git workflow/ three tree architecture

To check the difference between Repository and working directory using following command-

git diff

To get the difference in words instead  of whole statement highlighted with diff, use following command-

git diff --color-words

To check  staged changes difference, use following command-

git diff --staged

To delete file from working directory and from repo, use following command-

git rm file-to-delete.txt

The file will be staged with this command so you dont need to explicitly stage the deleted file.

Commit this file-

git commit -m "file deleted."

Please note while doing so the files will be permanently deleted and not found in thrash to recover. So use this command wisely if the file is not in the repo for you to pull back.

Rename file in repository and working folder, use following command-

 git mv filebeforerenaming.txt fileafterrenaming.txt

This shall rename file and stage the changes. So this is not required to manually staged.