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:

  • How to lock git push origin master behind sudo
  • git commit doesn't work from a cron job, although git pull does work
  • Using Git local repository as dependency in SBT project?
  • Integrate indentation & content changes in Git during merge: Best practices?
  • Git: How to search for a deleted file in the project commit history?
  • Git pathspec error - archive
  • 1) directory-to-ignore

    2) directory-to-ignore/

    3) directory-to-ignore/*

  • How to checkout jetty util jetty-util-8.1.17.v20150415 from git
  • How to push a “git replace --graft”
  • What are the common usages of tagging something else than a commit?
  • How to view branch descriptions (without editing them)?
  • How do I set the topic from the command line when I push a new commit to gerrit?
  • git-svn fails to dcommit, even after clean checkout
  • 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:


    so, option 2 is correct

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