简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM