What is syntax for ignoring a directory in Git?

When I want to add an entire directory to my .gitignore, what is the syntax? The directory-to-ignore is in my root directory.

Should it be:

  • gitosis + git error: fatal: '/home/git/repositories/idea-generator.git' does not appear to be a git repository
  • When is the right time to delete a git feature branch?
  • Is squashing commits into one best practice (for this particular workflow)?
  • How can I find an unreachable commit hash in a GIT repository by keywords?
  • IntelliJ IDEA GitHub integration creates the repository, but gets “couldn't authorize” error trying to push
  • Invalid active developer path error after upgrading to El Capitan
  • 1) directory-to-ignore

    2) directory-to-ignore/

    3) directory-to-ignore/*

  • Why after copying git repository to another dir I have modified files?
  • How to revert a merge which used strategy=ours?
  • How to set difftool/mergetool for a specific file extension in Git?
  • Making 'git log' ignore changes for certain paths
  • Apply patch to file that's under Git without using Git?
  • git: Your branch and 'origin/master' have diverged - how to throw away local commits
  • One Solution collect form web for “What is syntax for ignoring a directory in Git?”

    just add the directory to the .gitigore like:

    .gitignore file:

    directory-to-ignore/
    

    so, option 2 is correct

    Git Baby is a git and github fan, let's start git clone.