---
title: "UE4 SVN/P4（Perforce） commit filter"
author: "AVI"
date: "2021-02-08T14:42:28Z"
tags: []
categories: ["研发管理"]
slug: "ue4-svn-p4-perforce-commit-filter"
draft: false
lastmod: "2021-02-08T14:42:28Z"
id: 2519130
url: "https://avi.iteye.com/blog/2519130"
---

UE4 的 SVN/P4 服务器目录只需保存 Config、Content（Collection、Developer 子目录可忽略）、Plugins、Source、.uproject 即可。

 

 

【SVN】

 

1、打开SVN客户端-----常规设置------全局忽略样式，替换：

 

Binaries Intermediate Saved launcher.sln .vs DerivedDataCache Collections Developers \*.o \*.lo \*.la \*.al .libs \*.so \*.so.\[0-9]* \*.a \*.pyc \*.pyo \_\_pycache\__ \*.rej \*~ #\*# .#* .\*.swp .DS\_Store \[Tt]humbs.db

 

   注意：添加时注意最开头的字符与已有配置之间的空格区分。

 

2、在工程根目录提交验证签入情况，“Binaries Intermediate Saved launcher.sln .vs DerivedDataCache Collections Developers” 文件/文件夹已被过滤。

 

 

【Perforce】

 

在工作区的根目录中创建 p4ignore.txt 文件并写入以下过滤：

 

\# a list of file or directory names to be ignored in

\# Ignore .p4ignore files  
.p4ignore

\# Ignore directories  
Binaries  
Intermediate  
Saved  
DerivedDataCache  
Collections  
Developers

\# files  
\*.sln  
\*.vs

\# do not ignore this  
!README.md

 

在命令行中，将`P4IGNORE`环境变量设置为指向它（确保使用绝对路径）：

 

p4 set P4IGNORE=E:\\ue4-xxx\\p4ignore.txt

 

执行完此操作后，任何添加忽略列表中文件或目录都将被拒绝。

 

参考：

https://community.perforce.com/s/article/1282

https://www.perforce.com/perforce/doc.current/manuals/p4guide/Content/P4Guide/less\_common.files.ignore.html

https://community.perforce.com/s/article/6510

https://zhk.me/696.html