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 view
is displayed, and in a dialog box, afiles were not marked for add
message 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
.p4ignore
file 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

## This p4ignore file is a combination of Epic's documentation, but
## adjusted to work even if it's not in the same folder as the .uproject
## file, and the p4ignore gist from Luis Placid.
# The syntax for P4IGNORE files is not the same as Perforce syntax.
# Instead, it is similar to that used by other versioning systems:
#
# - Files are specified in local syntax
# - a # character at the beginning of a line denotes a comment
# - a ! character at the beginning of a line excludes the file specification
# - a * wildcard matches substrings.
#
# For example:
#
# foo.txt Ignore files called "foo.txt"
# *.exe Ignore all executables
# !bar.exe Exclude bar.exe from being ignored
# Files generated by Visual Studio should not be checked in
*.csproj.*
.vs/*
*.pdb
*.suo
*.opensdf
*.sdf
*.tmp
*.mdb
obj/
*.vcxproj
*.sln
*-Debug.*
# Git generate file structures
.git/
# Ignore JetBrain's IDE folders
.idea/
!.idea/runConfigurations
.gradle/
# Python cache files
__pycache__
*.pyc
# egg-infos
p4util.egg-info
*.egg
# Unix specific generated files should not be checked in
**/FileOpenOrder
*.xcworkspace
*.xcodeproj
./Makefile
./CMakeLists.txt
.ue4dependencies
# Do not check in samples & featurepacks copies provided by the engine
Samples/*
FeaturePacks/*
Templates/*
**/Engine/Documentation/*
# Saved files are overwritten by each person. Should not be checked in
**/Saved/
# Ignore UBT's configuration.xml
Engine/Programs/UnrealBuildTool/*
*.uatbuildrecord
# Do not save results of local builds (locally compiled engine build from source)
**/LocalBuilds/
# Ignore built binaries and temporary build files
*/obj/*
*.csprojAssemblyReference.cache
# Intermediates
**/Intermediate/
# Intermediate folders created for various C# programs
Engine/Source/Programs/*/obj/*
# Saved folders for programs should not be checked in
Engine/Programs/*/Saved/*
Engine/Programs/UnrealBuildTool/*
# Derived data cache should never be checked in
/DerivedDataCache/*
# Ignore any build receipts
**/Engine/Build/Receipts/*
# Ignore personal workspace vars
.p4config.txt
# Ignore Unix backup files
*~
# Ignore Mac desktop services store files
.DS_Store
# Ignore crash reports
crashinfo--*
# Ignore linux project files
*.user
*.pro
*.pri
*.kdev4
# Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# Ignore documentation generated for C# tools
**/Engine/Binaries/DotNET/UnrealBuildTool.xml
Engine/Binaries/DotNET/AutomationScripts/BuildGraph.Automation.xml
# Ignore version files in the Engine/Binaries directory created by UBT
**/Engine/Binaries/**/*.version
# Ignore exp files in the the Engine/Binaries directory as they aren't C/C++ source files
**/Engine/Binaries/**/*.exp
# Ignore Swarm local save files
**/Engine/Binaries/DotNET/SwarmAgent.DeveloperOptions.xml
**/Engine/Binaries/DotNET/SwarmAgent.Options.xml
# Intermediary Files
*.target.xml
*.exe.config
*.exe.manifest
# Ignore autogenerated files from HoloLens WMRInterop
**/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/*
# Ignore all .code-workspace files
*.code-workspace

# 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.