-1

I'm having a tough time with .gitignore - It simply does not ignore the directories within the file. I have the .gitignore file on both my development and staging enviroment.

The contents are:

logs
/logs/
/logs/*
logs/
vendor
/vendor/
vendor/
vendor/*
/vendor/*

However, each time I do a git pull on staging I am guaranteed that the merge conflict occured for a file logs/access.log - The same counts for composer packages. If I do a composer update with the very next git pull there is normally a conflict.

If I do a git status on my dev machine (after the last push and having visited the site in my dev enviroment) git status indicates changes in the logs/access.log file under "changes not staged for commit" - Why is the file not being ignored entirely?

What am I doing wrong here? The above code is exactly the same for both dev and staging .gitignore files located in the root of my project.

Any advice?

mauzilla
  • 3,574
  • 10
  • 50
  • 86
  • 5
    If you have committed files before ignoring them, I'd delete them first: `git rm {file}` or `git rm -r {dir}` and then push. – Héctor Nov 13 '17 at 11:48
  • The ignore files are read only by [`git add`](https://git-scm.com/docs/git-add). If the file is already tracked by Git you have to remove it from the repository (`rm --cached vendor`) then commit. This [question](https://stackoverflow.com/a/27982346/4265352) [has been](https://stackoverflow.com/a/44568924/4265352) [asked](https://stackoverflow.com/a/32169427/4265352) and [answered](https://stackoverflow.com/a/40368893/4265352) [dozens](https://stackoverflow.com/a/36713835/4265352) [of](https://stackoverflow.com/a/44496852/4265352) [times](https://stackoverflow.com/a/38658666/4265352) on [so]. – axiac Nov 13 '17 at 12:47

1 Answers1

0

You have to tell git to stop tracking the files. Try,

git update-index --assume-unchanged [path]
madonius
  • 451
  • 4
  • 6