└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # `.gitignore` 2 | 3 | Create a `.gitignore` file in your root directory 4 | 5 | ## Ignoring single files 6 | 7 | **Must specify filename and extension** 8 | 9 | ```bash 10 | example.txt 11 | ``` 12 | 13 | ## Keeping single files 14 | 15 | ```bash 16 | !example.txt 17 | ``` 18 | 19 | ## Multiple files with the same extension 20 | 21 | ```bash 22 | *.txt 23 | ``` 24 | 25 | ## Multiple files with the same name 26 | 27 | ```bash 28 | example* 29 | ``` 30 | 31 | ## Folders 32 | 33 | ```bash 34 | examples/ 35 | ``` 36 | 37 | ## Files inside of folders 38 | 39 | **You can apply the same techniques for multiple files inside the root directory** 40 | 41 | ```bash 42 | examples/example.txt 43 | ``` 44 | 45 | ## Everything inside of a folder except for some files 46 | 47 | **When first ignoring the whole folder, you must have a star at the end.** 48 | 49 | **The star means you are ignoring the files in the folder, while not having a star means that you are ignoring the whole folder** 50 | 51 | ```bash 52 | examples/* 53 | !examples/example.txt 54 | ``` 55 | 56 | ## Ignoring files in every directory 57 | 58 | **This ignores all files named example.txt in every folder. You can use the same techniques for ignoring specific names or extensions with this syntax as well.** 59 | 60 | ```bash 61 | **/example.txt 62 | ``` 63 | 64 | ## Ignoring files only in the root directory 65 | 66 | **Must include a slash in the beginning** 67 | 68 | ```bash 69 | /example.txt 70 | ``` 71 | 72 | ## Matching many characters 73 | 74 | **This ignores files named `Example.txt` and `example.txt`. You can match against as many characters as you like at once.** 75 | 76 | ```bash 77 | [Ee]xample.txt 78 | ``` --------------------------------------------------------------------------------