0

I have a repository, on Windows 7, with a moderately deep directory tree, with lots of .log files scattered about. These .log files are output by programs for diagnostic purposes and I do not want Git to track them, report on them, or notice them in any way.

When I issue the 'git status' command I get a huge listing with all of the .log files displayed. I'd like to eliminate the .log files (and some other similar files as well) from the 'git status' listing so I can focus on the files containing program code.

I assume (perhaps incorrectly) that the way to do this is to specify what to omit in the '.gitignore' file. Is this the way to go? Anyway, below is the current contents of my '.gitignore'. It has absolutely no effect on the output of 'git status':

*.log
/*.log
./*.log
./**/*.log
**/*.log
/*.log
.\*.log
.\**\*.log
**\*.log
Argent
  • 885
  • 2
  • 9
  • 18
  • 1
    Just one entry `*.log` in the `project-root/.gitignore` must work for your case (git 2.8.3). I'd suggest you try it with a fresh new repository. – Pavel Vlasov Jan 03 '17 at 00:45
  • Once the files are being tracked, they'll continue to be tracked even though they match a .gitignore entry. Is that your issue? – erik258 Jan 03 '17 at 00:57
  • @DanFarrell: I would guess that's my issue. Is there a way to get Git to untrack a class of files? – Argent Jan 03 '17 at 01:21
  • 1
    It's a little tricky because the files are already tracked. It can be done, but not cleanly. See https://help.github.com/articles/remove-sensitive-data/. http://stackoverflow.com/questions/936249/how-to-stop-tracking-and-ignore-changes-to-a-file-in-git?rq=1 might aldo help you. – erik258 Jan 03 '17 at 01:22

1 Answers1

0

I only recently started tracking the project under consideration with Git. I concluded that the best, and certainly the simplest, course of action is to delete the '.git' directory and do a fresh 'git init', with a '.gitignore' file in place. Per the advice of @PavelVlasov I added the pattern

*.log

to the '.gitignore' file and that worked.

Lesson learned: Before doing a 'git init' determine what to exclude and deal with it in '.gitignore'.

Argent
  • 885
  • 2
  • 9
  • 18