Saving State
About to attempt something drastic? Before you do, take a snapshot of all files in the current directory and manage it with git.
$ git init $ git add . $ git commit -m "My git backup"
Now if something went bad, restore the pristine version.
$ git reset --hard
Add, Delete, Rename
If you add new files or subdirectories to your git project, you’ll have to tell Git.
$ git add readme.txtSimilarly, if you want Git to forget about certain files.
$ git rm readme.txt
Renaming a file is the same as removing the old name and adding the new name. There’s also the shortcut git mv.
$ git mv readme.txt readme.htm
What Have I Done?
Find out what changes you’ve made since the last commit.
$ git diff

