Frans Klip
Frans Klip

Reputation: 11

ignore a .odt# file for a git repo

I cannot make git to ignore the next file (using a local .gitinore file) :
.~lock.osc-kontrol2ms.odt#

It's a lock file for the libreOffice Writer document used to make notes for the project, and exists only if the document is open. Tried several types of wildcards and escapes in .gitignore, but the file keeps showing up as 'changed' in 'git status' and the git-cola GUI. Some other hidden files and directories are ignored nicely. I managed to remove the file from the git repo itself (it was added to the repo on creation).

I would appreciate some suggestions (running git v1.9.1 on ubuntu linux).

Upvotes: 1

Views: 385

Answers (2)

IvanMoreno
IvanMoreno

Reputation: 145

I think that your problem is that the file is already added to repository.

You should to delete this file from repo. Try with: git rm --cached 'file_name'

With --cached you remove it from repository but not from your filesystem

Upvotes: 1

Moses Koledoye
Moses Koledoye

Reputation: 78554

You've probably told git to track the file before. You need to remove it from your index before git can truly ignore it:

$ git rm .~lock.osc-kontrol2ms.odt#

or to remove all such extensions from your index:

$ git rm *.odt#

Then, add the file extension to .gitignore, if you haven't:

$ printf '\n*.odt#\n' >> .gitignore

Upvotes: 4

Related Questions