Step 10: Configure ignored files | Admin
It is best practice to ignore (not version) some files for security or performance reasons.
-
Versioning files makes them available to other users on the project. If you version user-specific settings or secret keys, it causes setting conflicts and security issues.
-
Versioning files that are automatically created and updated by a program is not efficient. These files can be regenerated by the program that generates them.
On this page:
Specify files to ignore
There are two ways to specify ignored paths in P4. You can use one, the other, or both.
Stream level for all users
In P4, you can specify ignored paths at the stream level in the Ignored field or by editing an existing stream. This applies the exclusions to all users. Any child streams automatically inherit the same excluded paths.
To learn more, see Set ignored paths at the stream level for all users.
p4ignore file for individual users
P4 also supports ignoring files using a p4ignore file, which is a file stored on each user's computer. A p4ignore file is more powerful than specifying paths to exclude at the stream level. Make sure the file is always included in each user workspace. Some users prefer the flexibility this provides because each user can edit the p4ignore file or add extra files. However, this requires your entire team to be well-trained in p4ignore files.
- To learn more about how to set up an ignore file, see Set up and create an ignore file.
- To learn more about the P4IGNORE variable, see the P4 CLI Reference.
- For examples of ignore files for game engines, see p4ignore file examples.
Set ignored paths at the stream level for all users
-
To edit an existing stream, in P4V, right-click it in the Stream Graph and choose Edit Stream.
If the Stream Graph is not visible, click the + button and select Stream Graph. -
Add one line for each file path to ignore. If you are using P4 with Unreal Engine, you can use the following as a basic set of ignored paths to include at the stream level.
-
/Saved/... -
/Intermediate/... -
/DerivedDataCache/... -
/FileOpenOrder/... -
/obj/... -
.pdb -
-Debug.* -
/.vs/... -
.sln
-
-
P4 is case-sensitive, so double check your paths to make sure you are using casing consistently.
-
*can be used as a wildcard to match any number of characters. -
A slash (
/) at the end of a path will only match directories. In any other place in the path, it matches files or directories. -
You can use wildcards at the end of a line:
-
Use
...to match any number of characters in any subfolders. -
Use
*as a recursive wildcard to match any number of characters, but no subfolders. Recursive wildcards can affect performance.
-
-
Click Apply to save the changes and keep the window open, or click OK to save the changes and close the window.
| To ignore: | Add this line in the Ignored field: |
|---|---|
All files that end in .env |
.env
|
| All files in a folder named DerivedDataCache, including subfolders | /DerivedDataCache/…
|
| All files in a folder named Intermediate that is in a folder named Build | /Build/Intermediate/…
|
Remember that:
Create the ignore file
Use the following steps to set up and create the ignore file.
To learn more about creating an ignore file, you can also watch this video.
Step 1: Create an ignore file
-
To create an ignore file, open a text editor and save an empty file named
p4ignore.txt(typically for Windows) or.p4ignore(typically for Linux or macOS) in your workspace root. For example:C:\Users\YourName\Perforce\Yourname_Workspace\.p4ignore.An ignore file in a folder affects all files in the folder. Normally, you create an ignore file in your workspace root. You can also have ignore files in subfolders that affect only those folders and their children. -
In the file, enter one line for each file path to ignore. If you are using P4 with a game engine, use the examples in p4ignore file examples to get started.
Remember that:
-
P4 is case-sensitive, so double check your paths to make sure you are using casing consistently.
-
*can be used as a wildcard to match any number of characters. -
A slash (
/) at the end of a path will only match directories. In any other place in the path, it matches files or directories. -
A
!at the beginning of a line ensures that matched files are not ignored, even if a previous rule matches them. -
You can use wildcards at the end of a line:
-
Use
...to match any number of characters in any subfolders. -
Use
*as a recursive wildcard to match any number of characters, but no subfolders. Recursive wildcards can affect performance.
-
-
-
Save the ignore file.
To learn more about ignore files, see P4IGNORE in the P4 CLI Reference .
Step 2: Test the ignore file
You can add a file in P4V or use the p4 ignore command to test if individual lines in your ignore file are working as intended.
Add a file in P4V
In P4V, add a file that should be ignored.
-
Add a file or folder affected by the rule to the workspace folder on your computer.
-
Change logging preferences to get feedback on ignored files in the Log pane.
In P4V, choose Edit > Preferences (Windows) or P4V >Preferences (Mac). In the Preferences dialog box, select Logging. Check the box Show p4 reporting commands. Click OK to save your changes and exit the dialog box.
-
Choose View > Workspace Tree. The workspace tree shows files and folders in your workspace. Click Refresh on the toolbar to see the file you added in the workspace tree.
-
In the workspace tree, select the file to be ignored.
-
On the toolbar, click Add to add the selected file to a default changelist.
To submit new or changed files to the P4 Server, you use a changelist. A changelist defines a logical grouping of work across a set of files and folders.
-
To see your pending changelist, choose View > Pending Changelists. In the Pending tab in the right pane, you will see the default changelist. Expand the changelist to view the list of files.
-
If you added the rule correctly, the affected file is not added to the changelist. In the Log pane, the message
file(s) not in client viewis displayed, and in a dialog box, afiles were not marked for addmessage is displayed.
Use the p4 ignores command
In the terminal, run p4 ignores -i -v path , where path is the path to the file to check.
The output displays if the file was ignored or not, and which line in the ignore file is the one that matched.
Step 3: Add the ignore file to P4 Server
Complete the following steps to add your ignore file to the server.
-
In P4V, click select the
.p4ignorefile in the workspace. -
On the toolbar, click the Add button, or right-click the file and select Mark for Add. This adds the file to the default changelist.
-
To see your pending changelists, choose View > Pending Changelists. In the Pending tab in the right pane, you will see the default changelist. Expand the changelist to view the list of files.
-
Select the pending changelist and click Submit on the toolbar.
-
Enter a changelist description so you and your team can see what each person did, and which tasks are complete.
-
Click Submit.
Your ignore file is now saved in the depot so that it will be available to your users. Optionally, you can create and add an ignore file for your colleagues to use as a template, so that they can create their own ignore files as needed.
p4ignore file examples
## Universal P4IGNORE for Unreal Engine Projects and common DCC tools
## Works with both game projects and custom engine source
## Optimized pattern usage based on Perforce P4IGNORE documentation
## This p4ignore file should be named .p4ignore or p4ignore.txt and
## placed in the workspace root, which should be where the Engine and
## project folders are located.
# The syntax for P4IGNORE files is not the same as Perforce syntax.
# Key differences from .gitignore:
# - A / at the start means "relative to this p4ignore file"
# - A / at the end means "directories only"
# - * matches substrings but NOT path separators (like P4 wildcard)
# - ** matches substrings INCLUDING path separators (like P4 "..." wildcard)
# - ! at the start excludes the file specification
###############################################################################
# Visual Studio Solution and Project Files
###############################################################################
# Ignore root Visual Studio solution files only
/*.sln
/*/*.sln
# Visual Studio temp files (but exclude when .pdb is in folder path)
.vs/
*.pdb
!*.pdb/
*.suo
*.opensdf
*.sdf
*.tmp
*.mdb
obj/
*.vcxproj
# User-specific Visual Studio files
*.csproj.user
*.csproj.cache
*.csproj.nuget.*
*.csproj.AssemblyReference.cache
# Note: DO NOT ignore *.csproj.props - these are shared build configuration files
# Built binaries and temporary build files
obj/
*.csprojAssemblyReference.cache
###############################################################################
# Git Integration (if migrating from Git)
###############################################################################
.git/
.gitignore
.gitattributes
.gitmodules
.tgitconfig
###############################################################################
# JetBrains IDEs
###############################################################################
.idea/
!.idea/runConfigurations
.gradle/
###############################################################################
# Python
###############################################################################
__pycache__/
*.pyc
*.egg-info/
###############################################################################
# Unix/Mac Specific
###############################################################################
FileOpenOrder/
*.xcworkspace/xcuserdata/
*.xcodeproj/xcuserdata/
*.xcodeproj/project.xcworkspace/xcuserdata/
.ue4dependencies
*~
.DS_Store
###############################################################################
# Unreal Engine - Core Ignores
###############################################################################
# Samples, FeaturePacks, Templates at root only
/Samples/
/*/Samples/
/FeaturePacks/
/*/FeaturePacks/
/Templates/
/*/Templates/
# Saved and Intermediate directories (generated content)
# These can be at any depth, so use **/
**/Saved/
**/Intermediate/
# Derived Data Cache - use specific patterns to avoid matching source code
**/DerivedDataCache/Boot.ddc
**/DerivedDataCache/**/*.udd
**/DerivedDataCache/
!**/Source/**/DerivedDataCache/
# Personal workspace configuration
.p4config.txt
.p4sync.txt
# Crash reports
crashinfo--*
# Linux project files
*.pro
*.pri
*.kdev4
# Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
Binaries/**/*.dSYM
Binaries/**/*.dsym
# VSCode workspace files
*.code-workspace
# UGS folder (per-workspace)
.ugs/
# Local builds
/LocalBuilds/
!ArchiveForUGS-Perforce/
###############################################################################
# Engine-Specific Paths
# Use **/ prefix so these work whether Engine is at root or nested
###############################################################################
# UnrealBuildTool logs and configuration
**/Engine/Programs/UnrealBuildTool/*.txt
*.uatbuildrecord
# Build receipts
**/Engine/Build/Receipts/
# C# program intermediates and saved folders
**/Engine/Source/Programs/*/obj/
**/Engine/Programs/*/Saved/
# Documentation tools output
**/Engine/Binaries/DotNET/UnrealBuildTool.xml
**/Engine/Binaries/DotNET/AutomationScripts/BuildGraph.Automation.xml
# Version files created by UBT
**/Engine/Binaries/**/*.version
# Export files (linker-generated, not source)
**/Engine/Binaries/**/*.exp
# Swarm local save files
**/Engine/Binaries/DotNET/SwarmAgent.DeveloperOptions.xml
**/Engine/Binaries/DotNET/SwarmAgent.Options.xml
# HoloLens WMRInterop autogenerated files
**/Engine/Source/ThirdParty/WindowsMixedRealityInterop/packages/
**/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/Generated Files/
**/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/x64/
**/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/ARM64/
**/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/x64/
**/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/ARM64/
###############################################################################
# DCC Application Autosave and Temporary Files
# Using specific extensions and patterns to avoid catching legitimate files
###############################################################################
# Blender - specific extensions only
*.blend1
*.blend2
*.blend@
untitled.blend
# Autodesk Maya
*.ma.swatches
*.mb.swatches
*_incrementalSave_*.ma
*_incrementalSave_*.mb
incrementalSave/
scenes/edits/
# Autodesk 3ds Max
*.max.bak
autoback/
MaxStart.max
# Cinema 4D
*.c4d.zip
*.c4d~
# Houdini
*.hip.bak
*.hipnc.bak
*.hiplc.bak
# ZBrush
*.ZTL.bak
*.ZPR.bak
QuickSave*
# Substance Painter/Designer
*.spp.bak
*.sbs.bak
*.sbsar.bak
# Adobe Creative Suite - full extensions to avoid false matches
*.psd~
*.ai~
*.indd~
*.fla~
*.aep~
*.prproj~
Adobe After Effects Auto-Save/
Adobe Premiere Pro Auto-Save/
Photoshop Temp*
# Audio Applications
# Pro Tools
*.ptx~
*.ptf~
Session File Backups/
# Reaper
*.rpp-bak
*.rpp~
# Logic Pro
*.logic/Alternatives/
*.logic/Backups/
# Cubase/Nuendo
*.cpr.bak
*.npr.bak
# Ableton Live
*.als~
# FMOD
*.fspro.bak
*.fspro~
# Wwise
*.wproj.bak
*.wsettings.bak
# General DCC patterns (specific directory names only)
.mayaSwatches/
# Unity Files and Folders to ignore
Library/
Temp/
Obj/
Build/
Builds/
UserSettings/
MemoryCaptures/
Logs/
Assets/AssetStoreTools/
Assets/AddressableAssetsData/*/*.bin*
Assets/StreamingAssets/aa.meta
.collabignore
# Build files to ignore
*.apk
*.unitypackage
# Gradle cache directory
.gradle
# Autogenerated project files
/Assets/Plugins/Editor/JetBrains*
.vs
ExportedObj/
.consulo
*.csproj
*.unityproj
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
What's next
Next, populate the stream with files.