D.7 Version control
If your website source files are under version control, we recommend that you add at least these two folder names to your
blogdown/ directory is used to store cache files, and they are most likely to be useless to the published website. Only knitr may use them, and the published website will not depend on these files.
public/ directory should be ignored if your website is to going to be automatically (re)built on a remote server such as Netlify.
As we mentioned in Section D.5, R plots will be copied to
static/, so you may see new files in GIT after you render an Rmd file that has graphics output. You need to add and commit these new files in GIT, because the website will use them.
Although it is not relevant to blogdown, macOS users should remember to ignore
.DS_Store and Windows users should ignore
If you are relatively familiar with GIT, there is a special technique that may be useful for you to manage Hugo themes, which is called “GIT submodules.” A submodule in GIT allows you to manage a particular folder of the main repository using a different remote repository. For example, if you used the default
hugo-lithium from my GitHub repository, you might want to sync it with my repository occasionally, because I may update it from time to time. You can add the GIT submodule via the command line:
git submodule add \ https://github.com/yihui/hugo-lithium.git \ themes/hugo-lithium
If the folder
themes/hugo-lithium exists, you need to delete it before adding the submodule. Then you can see a SHA string associated with the “folder”
themes/hugo-lithium in the GIT status of your main repository indicating the version of the submodule. Note that you will only see the SHA string instead of the full content of the folder. Next time when you want to sync with my repository, you may run the command:
git submodule update --recursive --remote
In general, if you are happy with how your website looks, you do not need to manage the theme using GIT submodules. Future updates in the upstream repository may not really be what you want. In that case, a physical and fixed copy of the theme is more appropriate for you.