pierrotlefou
pierrotlefou

Reputation: 40761

how to ignore a file using .gitignore

I deleted a file path/to/the/file.cpp, which is the relative path from top of the git repository but I want to that file be ignored by git status.

Tried put following patterns in the .gitignore files but seems none of them works.

**/file.cpp
file.cpp
path/to/the/file.cpp

Any ideas? Thanks.

Upvotes: 1

Views: 57

Answers (1)

biobirdman
biobirdman

Reputation: 4120

this is what you must to

git rm path/to/the/file.cpp

and now when your git ignore should work

.gitignore

path/to/the/file.cpp

As Matti Virkkunen pointed out, your file must have been already tracked by git.

Upvotes: 2

Related Questions