Skip to content

Instantly share code, notes, and snippets.

@Aeva
Last active February 1, 2025 18:16
Show Gist options
  • Save Aeva/26edd75aa1f042e35099a4d9b313fb38 to your computer and use it in GitHub Desktop.
Save Aeva/26edd75aa1f042e35099a4d9b313fb38 to your computer and use it in GitHub Desktop.
p4ignore tutorial

The p4ignore file lives in the client root directory, and is enabled with the following command:

> p4 set P4IGNORE=p4ignore.txt

When enabled, file paths that match the pattern described will be ignored when adding changes or new files. For example, this is used to exclude build results and tempfiles so as to keep change logs cleaner and prevent unnecessary merge conflicts.

In p4v, the ignored files will still be visible, but the interface will prevent you from adding them. For example, if you add a directory, and within the directory there is an ignored file, the non-ignored files will still be added, and a window will pop up informing you which files were not added.

Files that were already added will not be matched by the ignore list, and it might be the case that you can still explicitly add ignored files via the command line tools. If you need to explicitly add a specific file that is being ignored, it is better practice to do so by adding an exception to the end of the ignore file by preceding the rule with an exclamation point!

The syntax of the ignore file is almost identical to git’s .gitignore file, but it is not entirely the same. The syntax isn’t parsed entirely the same way, and the differences do not seem to be well documented. You can find some of the known differences here:

The gitignore syntax is well documented, and I recommend reviewing this page if you are not familiar with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment