Literal File Names
-The easiest pattern is a literal file name, for example:
This will ignore any files named whitelist.txt, which is a common file on Minecraft servers.
-You can ignore entire directories, just by including their paths and putting a / on the end:
If you leave the slash off of the end, it will match both files and directories with that name.
-The * matches 0 or more characters (except the /). So, for example, *.log matches any file ending with the .log extension.
Another example is *~, which matches any file ending with ~, such as index.cfg~
You can also use the ?, which matches any one character except for the /.
-You can use a prefix of ! to negate a file that would be ignored.
In this example, example.log is not ignored, even though all other files ending with .log are ignored.
But be aware, you can't negate a file inside of an ignored directory:
Due to performance reasons, backup will still ignore logs/example.log here because the entire logs directory is ignored.
-** can be used to match any number of directories.
**/logs matches all files or directories named logs (same as the pattern logs).
*/logs/.log matches all files ending with .log in a logs directory.
logs/*/.log matches all files ending with .log in the logs directory and any of its subdirectories.
Double asterisk can also be used to match all files inside of a directory, so for example logs/** matches all files inside of logs.