Why should I use version control with my WordPress site? And what should I put under version control?
Why should I use version control with my WordPress site?
Keeping your files under version control is an extra step, but it gives you access to the history of your changes and the ability to use branches while you are testing out a new feature or change. You may also be able to use Git to push your updated files to your host if they have Git integration.
While having Git keep track of your project and pushing it up to GitHub or Bitbucket means that most of your files are backed up, it is important to keep in mind your database is not under version control. So using Git is not a replacement for your good old complete backup. Making a complete site backup on a regular basis is super important!
What should I put under version control?
Lots of folks have opinions on which part of a WordPress installation should be put under version control. The whole thing? Only the wp-content directory? Only the theme?
The answer to this question will depend on a variety of factors, such as the size of your installation, whether you are working as part of a team and if you are using Git as part of your deployment process, to name a few. For example, in Skillcrush 203 (WordPress Best Practices), we keep the entire installation under version control, which works well with WPEngine's Git deployment process.
Regardless if you choose to put the whole site under version control or just the wp-content folder, you are going to want to use a .gitignore file as there are going to be a few things you'll never want to version like the wp-config.php file (since it can contain sensitive information you don't want public) or .DS_Store files for those on Macs.