5 Tell git to ignore files
Make a file named .gitignore
(you can also use nano/any-text-editor to do it)
Make a file that we would want git
to ignore
Add this file to .gitignore
Try git add
a file we told .gitignore
to not track
## The following paths are ignored by one of your .gitignore files:
## ignore_this.txt
## Use -f if you really want to add them.
If you want to add
a supposedly ignored file, use the -f
flag
## [master 43d9a3d] Add ignore_this.txt
## 1 file changed, 0 insertions(+), 0 deletions(-)
## create mode 100644 ignore_this.txt
5.1 BONUS - Use wildcard
You can use wildcard expressions in this file as well. Some common things in a .gitignore
file are .*
, *~
, ~*
, which are often temporary or backup files.
There should now be a .gitignore
file in your directory.