Adding repository rules to ignore files and directories

You can define rules to ignore files and directories when recursively adding files, viewing working directory differences, and pushing changes for a specific repository. For example, you may have debug files in your working directory that you do not want to add to Surround SCM. You can define rules to ignore those files unless they are selected when recursively adding files.

To define rules, add an .sscmignore file to your working directory associated with the repository where you want to ignore files and directories. The rules are applied recursively relative to the location of the .sscmignore file when you perform actions that use ignore rules.

To share the rules with other team members who may need to use them, add the .sscmignore file to the repository so they can get it to their working directory.

You can also configure your own rules to apply to any area you work in Surround SCM, rules for all users in specific mainline branches, rules for all users in all mainline branches. See Ignoring files and directories.

1. Create a new file in a text editor.

2. Enter the rules for files or directories to ignore. See Example file.

  • Rules are not case sensitive on Windows and are case sensitive on macOS and Linux.
  • Each rule applies to a file or directory name.
  • To indicate a rule only applies to files and directories at the same level as the .sscmignore file, start the line with /. For example, /Debug.
  • To indicate a rule only applies to directory names, end the line with /. For example, Users/.
  • To indicate a line is a comment, start the line with #. For example, #This is a comment.
  • Rules use a glob-style pattern when you use the supported symbols. If a rule does not use these symbols, it is interpreted as a regular string match for a file or directory name.
Symbol/structure Matches: Example
* One or more characters *.exe matches any string that ends in .exe
? One character .?at matches files that end in .dat, .bat, and any files that have a single character that follows a period and end with ‘at’. Does not match .at or .data.
[<characters>] or [<character start-character end range>] One character that is between the brackets. Character ranges are supported. For example, [abc] or [a-c]. *.[gp]ch matches strings that end in .gch and .pch only

*.[b-d]at matches strings that end in .bat, .cat and .dat
[!<characters> or [!<character start-character end range>] One character that is not between the brackets. Character ranges are supported. For example, [!xyz] or [!x-z]. *.[!dc]at matches strings that end with .bat, but not .cat or .dat

*.[!d-h]pp matches strings that end in .cpp (and others), but does not match strings that end in .dpp, .epp, .fpp, .gpp or .hpp
  • Special characters (e.g., [], *, ?, !, -, \) can be matched, but must be escaped with \.

3. Save the file as .sscmignore in the working directory where you want to apply the rules.

The rules are applied when you recursively add files, view working directory differences, and push changes for the associated repository.

The file must be named .sscmignore. If you are saving the file from a text editor, such as Notepad, do not save it as .txt or another format. If you rename an existing file using Windows Explorer and get a filename error, enter a period at the end of the filename (.sscmignore.) to rename it and Windows Explorer will delete the trailing period so the filename is correct.

Example file

# Ignore all object files (Windows and Unix)

*.o

*.obj

 

# Ignore all cpp and hpp files

*.[ch]pp

 

# Ignore node_modules directories

node_modules/

 

# Ignore files and folders named bin

bin

 

# Ignore Debug and Release directories in the current directory only

/Debug/

/Release/

 

# Ignore all exe files in the current directory only

/*.exe