0

I have a directory in a project which only contains a single file called chat.log. The directory is named ~. Yeah, just that. And it is located in the root of the project. I tried to add the directory and/or the file to .gitignore, but nothing seems to work. I tried adding:

~
~/*
*/chat.log 
chat.log

But really, nothing seems to work. What do I do?

Cœur
  • 37,241
  • 25
  • 195
  • 267
hrss
  • 137
  • 2
  • 2
  • 10
  • What is the output of you running git status? – HMLDude May 03 '17 at 03:08
  • Why would you put a tilde in the name? You're just asking for trouble. Welcome to trouble land – Joe Phillips May 03 '17 at 03:13
  • This was the output: modified: .gitignore modified: ~/chat.log – hrss May 03 '17 at 03:26
  • And yeah, I know it's asking for trouble, but I got the project like this, and I don't think I can go around renaming stuff. – hrss May 03 '17 at 03:27
  • Possible duplicate of [How to make Git "forget" about a file that was tracked but is now in .gitignore?](http://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – 1615903 May 03 '17 at 04:09
  • If it says the chat log file is modified this means git is already tracking the file, .gitignore is not consulted when determining if a tracked file has modified, only when determining which files to add to the index. – Lasse V. Karlsen May 03 '17 at 09:29

2 Answers2

2

Is the file already added to the project? As in, Git is currently tracking it? I don't know about folders, but Git is not always happy about files containing tilde.

Community
  • 1
  • 1
J.N.
  • 537
  • 2
  • 10
  • Yeah, the file was being tracked. I deleted it and added /~/*.log to .gitignore, this worked. Thanks for the link, man. – hrss May 03 '17 at 03:05
0

Deleting the file and adding /~/*.log to .gitignore did the trick.

hrss
  • 137
  • 2
  • 2
  • 10