gitignore how to ignore a file and not a directory tree

I have a weird behavior with my .gitignore file

My project tree looks like this

  • What is the correct way to deal with DB migration while using South, Django and Git?
  • git svn - Can I use git and svn at the same time? no need interaction between git and svn
  • How and when do Mercurial or git diff files?
  • How does the Android repo manifest repository work?
  • Can “git pull” automatically stash and pop pending changes?
  • What's the correct way to check if it's possible to perform a fast-forward merge with git merge-base?
  • abc
     |-> inc
     |-> src
     |-> obj---
     |        |-> abc (The exeutable file)

    I would like that the abc executable will be ignored so I added abc to my .gitignore file.
    but now, the whole abc tree is ignored.

    How can I specify that I want to ignore only a file called abc, and not a directory ?


    My .gitignore file:


  • Eclipse-fetch says my Git repo is current so what's the ↓13 mean?
  • Unable to run TortoiseGit + cntlm + proxy server
  • How to merge only once when master branch diverged?
  • JGit: Push to specific branch
  • Unknown git branch checked out
  • Pruning several consecutive commits in history
  • 2 Solutions collect form web for “gitignore how to ignore a file and not a directory tree”

    You could specify the path:


    You can include a “negative” pattern in your .gitignore file:

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