- Change directory Wordpress root directory (on local system or remote server).
- Add
.htaccessand.gitignorefiles. - Run
git initon the Wordpress directory. - Run
git add --all - Run
git commit -am "Initial Commit" - Change some files.
- If on remote server, run
git status- If local, sync with remote FTP first. - Commit new changes with
git commit -am "Commit message".
If you wish to track the project on GitHub.com, please follow the official guide on adding an existing project to GitHub. Using a private repository is reccomended, to keep any sensitive files or information secret.
git ls-files -dmo --exclude-standard
Will return empty if there are unchanged files.
git diff
Shows differences between changed file versions.
Q: What is the .htaccess file for?
A: Prevents the hidden .git directory from being served by the webserver. This directory can contain internal details or Git passwords, so we don't want open to the public.
Q: What is the .gitignore file for?
A: Generated content (user- or otherwise) should not be tracked, however this may vary depending on your use case. You may want to track the /wp-config.php for changes also, which can be achieved by removing that line from the .gitignore file.