How to do it...

  1. First, we'll create some files and directories:
$ echo "Testing" > test.txt
$ echo "Testing" > test.txt.bak
$ mkdir bin
$ touch bin/foobar
$ touch bin/frotz
  1. Let's see the output of git status:
$ git status
On branch ignore
Your branch is up-to-date with 'origin/ignore'.
    
 Untracked files:
   (use "git add <file>..." to include in what will be committed)
    
     test.txt
    
nothing added to commit but untracked files present (use "git add" to track)
  1. Only the test.txt file showed up in the output. This is because the rest of the files are ignored by Git. We can check the content of .gitignore to see how this happened:
$ cat .gitignore
*.config
*.bak
    
# Java files
*.class
    
bin/

This means that *.bak, *.class, *.config, and everything in ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.