gitignore a specific file

C++
# exclude everything
somefolder/*

# exception to the rule
!somefolder/.gitkeep *.log
!spec/*.log$ echo debug.log >> .gitignore $ git rm --cached debug.log rm 'debug.log' $ git commit -m "Start ignoring debug.log" 
Source

Also in C++: