Git .gitignore to ignore only folder in root directory

Here is my .gitignore


and I have installed git on the folder named project there is a folder named static and another folder called app and inside an app, there is another folder static. The above .gitignore ignore both static folders, That is not what I want.

  • Git branching model strategy
  • How can I review manually resolved conflicts in git (github, some app, InteliJ)
  • push using multiple account / multiple identity on github / bitbucket
  • How to “cat” a file in JGit?
  • Ignore file .pyc in git repository
  • How to split a branch in two with Git?
  • What I want is to ignore the folder project/static/ not the folder project/app/static/ How can I do that?

  • 'Android Pre Compiler' error 'Path must include project and resource name'
  • Git merge branch of another remote
  • unable to clone git repository on laptop, however, cloned successfully on dev machine
  • Make changes to a git submodule and then add those into my main project
  • Commits that have gone through Differential show up in Phabricator audit system
  • Single file as Git submodule
  • One Solution collect form web for “Git .gitignore to ignore only folder in root directory”

    Just add / before static/, should be like

    # ^ forward slash before the folder name signifies root dir
    Git Baby is a git and github fan, let's start git clone.