Basic Git Notes

Posted August 23, 2011 in Git By Levi Putna


Warning: file_get_contents(/home/content/m/m/o/mmowbiz/html/wp-content/plugins/member-terms-conditions/terms-and-conditions/terms-and-conditions.txt) [function.file-get-contents]: failed to open stream: Permission denied in /home/content/m/m/o/mmowbiz/html/wp-content/plugins/member-terms-conditions/terms-and-conditions.php on line 79

Warning: file_get_contents(/home/content/m/m/o/mmowbiz/html/wp-content/plugins/member-terms-conditions/terms-and-conditions/privacy-policy.txt) [function.file-get-contents]: failed to open stream: Permission denied in /home/content/m/m/o/mmowbiz/html/wp-content/plugins/member-terms-conditions/terms-and-conditions.php on line 83

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.txt

Similarly, 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

Leave a Reply

Your email address will not be published.

*