dbnex14 dbnex14 - 1 year ago 101
Git Question

Which global gitignore am I using?

I am new to git. Some time ago, I have set it up on my MacBook Pro and havent used it for months. Now I wonder how can I figure out following:

  1. Did I set already global gitignore and how to find out where it is located on my MacBookPro?

  2. Did I set multiple global gitignore files and how to find where they are on my system?

  3. If I have multiple global gitignore files, which one I is set to be used by git currently?

Please, provide best explanation, I am new to both MacBook terminal and git.

Answer Source

The gitignore you are using is the one in the closest parent directory to where your git repo is initialized. So if you have a file system like this:

  | .gitignore
  | user/
     | .gitignore
     | dev/
         | .gitignore
         | project/

If project is the directory of your git repository then the .gitignore being used is the one in dev as it is the closest parent to project.

To check what your global .gitignore is run git config --get core.excludesfile.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download