I use the Codeanywhere online IDE for my WordPress development. Sometimes I screw up something I’m testing (usually when I try to manipulate the filesystem with PHP) and need to reset my local branch to the last clean commit I sent to remote.
(Note that I said “remote”. I don’t trust local commits. I continually push to remote to have a safe restore point, especially if I need to do a full delete of my local branch. Yes, it has happened more than once.)
Occasionally I find folder permissions screw up as well and I need to reset via the bash command line.
The following commands are what I always come back to.
Note: The “$” in the command below represent the command-line prompt. The actual commands follow it.
Reset a local branch to the the last remote commit of the branch
$ git reset --hard HEAD
Clean up any uncommitted folders/files that the reset didn’t remove
$ git clean -f -d
Set full permission recursively on a folder and all files/sub-folders
Change directory (cd) to the parent folder of the folder you want to set permission on.
$ sudo chmod -R 777 vylesk-module-z1
Recursively delete a folder and all files/sub-folders
Change directory (cd) to the parent folder of the folder you want to delete.
$ rm -rf vylesk-module-z1
Note: The “f” means you are not prompted to delete each file/folder.