gitignore - Git does not ignore files in my project -


i still struggling git. have git local repos. below:

project   - .git      - .gitignore   - child [directory]   - files 

.gitignore:

target/ logs/  .ds_store 

and did.

git rm --cached . git add . 

i expected files , directories in .gitignore not tracked did not work. nothing in files ignored.

what can fix this?

your answer appreciated.

there 3 places can configure ignoring files in git (and .git/.gitignore not 1 of them). highest lowest precedence, are:

  • a .gitignore in same directory path, or in parent directory. .gitignores committed , versioned along rest of project. there commonly 1 in root of repository, can have many 1 per directory. file should contain project specific things ignore (build output , such).
  • a per repository file called .git/info/exclude. file not versioned , impact repository.
  • a global file specified configuration variable core.excludesfile. typically placed in users home directory named ~/.gitignore_global, named anything. file not versioned. applies git repositories. file should contain project agnostic things ignore (editor files, operating system files).

in case, should create .gitignore in root of project following in it:

target/ logs/ 

and create global gitignore .ds_store rule in ~/.gitignore_global:

.ds_store 

run git config --global core.excludesfile ~/.gitignore_global enable file.

see this helpful github article , gitignore(5) more information.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -