Unity3D 项目虽然说使用 C# 脚本开发,但毕竟不是 .NET/C# 项目。今天一位小伙伴告诉我说用错了 .gitignore 文件,结果管理仓库时丢了很多重要的文件。
实际上,GitHub 官方提供了大量不同项目类型的 .gitignore 文件,并且有广大的社区支持时时更新,直接前往 GitHub 官网下载是最好的选择了。
适用于 Unity 项目的 .gitignore 模板:
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreToo