git remove deleted files code example

Example 1: How to delete multiples files in Github

In the command-line, navigate to your local repository.
Ensure you are in the default branch:
git checkout master
The rm -r command will recursively remove your folder:
git rm -r folder-name
Commit the change:
git commit -m “Remove duplicated directory”
Push the change to your remote repository:
git push

Example 2: git recover deleted file

rm -rf deleted file, if there is any commit before use git commands:
// 1 Find out which comit has the copy of deleted file
git log         
// 2 Use checkout to locate which comit what file location
git checkout branch-number-here -- file/location/in/folder/without/quote
example: git checkout 476c714 -- mvc/public/js/bundle.js

Example 3: remove git deleted files

git add .  => Add all (tracked and modified)/new files in the working tree.

git add -u => Add all modified/removed files which are tracked.

git add -A => Add all (tracked and modified)/(tracked and removed)/new files in the working tree.

git commit -a -m "commit message" - Add and commit modified/removed files which are tracked.

Example 4: remove git deleted files

git commit -m "Deleted files manually"

Tags:

Misc Example