1. Edit .gitignore, located at the same level as the public directory, to add directories to be ignored (directory names are unknown). Some directories will be generated under the public directory, and all of these directories should be ignored. See Figure 1.

2. View the current content, all entries starting with /public/
/public/certificate_sandbox.*
/public/.well-known
/public/hot
/public/storage
/public/js
/public/global
/public/chunk
/public/default
/public/css
/public/venue
/public/showtime
/public/vogue
/public/athena
/public/checkout
/public/fonts
/public/iconfont
/public/images
/public/12345
/public/*.js
/public/*.js.LICENSE.txt
/public/mix-manifest.json
/public/nginx.htaccess
# /public/fonts
/public/vendor
/public/page-cache/
3. View the committed files under the public directory in GitLab that are not ignored. See Figure 2.

4. We cannot explicitly specify the directory names under public now, because these directory names (in UUID format) are automatically generated at program runtime.
5. Therefore, we can only explicitly define which files under the public directory should not be ignored. Refer to the ignored files section in: https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E8%AE%B0%E5%BD%95%E6%AF%8F%E6%AC%A1%E6%9B%B4%E6%96%B0%E5%88%B0%E4%BB%93%E5%BA%93 . First ignore all files under the /public directory, and then add exceptions. Adjust it as follows:
/public/*
!/public/modules
!/public/appcode.png
!/public/domain.txt
!/public/favicon.ico
!/public/index.php
!/public/logo.png
!/public/robots.pages.txt
!/public/robots.txt
!/public/tracking-api.js
!/public/web.config
6. Create new files /public/1.php and /public/modules/2.php. Upon committing, we find that only the file /public/modules/2.php is committed, and some UUID-generated directories have been ignored. This matches expectations. If new directories or files under the /public directory need to be committed later, you must add ! to confirm they should be tracked. See Figure 3.

