Git - Delete File & Folder from Git (CLI)
# Delete Folder From Git (Remote Server)
1. Go to your project directory
2. $ git pull
(Make your reposition up to date)
3. $ git -rm -r your-folder-name
(The rm -r command will recursively remove your folder)
4. $ git commit -m "your text to note when commit"
(Commit the change)
5. $ git push origin master
(Push the change to your remote repository)
# Delete File From Git (Remote Server)
1. Go to your project directory
2. $ git pull
(Make your reposition up to date)
3. $ git rm file1.txt
4. $ git commit -m "your text to note when commit"
(Commit the change)
5. $ git push origin master
(Push the change to your remote repository)
** if you want to remove the file only from the Git repository and not remove it from the filesystem, use:
$ git rm --cached file1.txt
$ git commit -m "remove file1.txt"