Git .gitignore to ignore only folder in root directory

Here is my .gitignore

static/

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 status takes too long
  • “ERROR:gitosis.serve.main:Repository read access denied” when trying to clone a git repo
  • Avoiding merge conflicts when merging master into per-host customized branch
  • git push error git-receive-pack
  • git push trying to push files not listed in git ls-files
  • View all revision numbers that made changes to a particular file in Mercurial
  • What I want is to ignore the folder project/static/ not the folder project/app/static/ How can I do that?

  • Branching and merging best practices in Git
  • git - should source files and repository be on the same machine?
  • Git with SSH on Windows
  • Git Invalid revision range Symfony2 composer external bundle
  • Bitbucket - push repo with git lfs
  • Reverting to a specific commit based on commit id with Git?
  • One Solution collect form web for “Git .gitignore to ignore only folder in root directory”

    Just add / before static/, should be like

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