In the git repository for your website, there’s a .gitignore file. It lists what files you don’t want to track as part of the repository.
There are different things you might want to ignore:
- small temporary files generated by the operating system your repository is on. For example, thumbnails or cloudsync files.
- important information that should not be made available to anyone who can access the repository: passwords files and access files like .htaccess
- anything that is not within your powers to change:
- user-generated information that isn’t related to coding, such as blog posts, uploaded pictures, and the like. Tracking these will make it a hassle to know if you’re up-to-date between your repositories, since they’ll change/add constantly to the number of files.
- If you’re only developing a wordpress website for yourself or a client, you’re not involved in modifying the core wordpress files themselves. These might change as you update to higher releases of wordpress, but they’re not something you want to track as part of your own development work.
- this may include basic wordpress themes you are using and plugins you are using. However, if you are developing your own child themes and plugins, you’ll want to track those folders specifically that contain your own work, so you exclude them from .gitignore (meaning they’ll be tracked).
Git is for tracking code. To protect, retrieve or reset an entire website with all its content, try a backup software/protocol/system instead. Though it could work with git, it’s impractical since you’d basically have to commit and validate every new picture or user-generated file every time.