Git ignore file for C projects Git ignore file for C projects git git

Git ignore file for C projects


I guess there will be a few generated files that you don't wan't to be sticking in your repo (assuming your build output dir is in your git heirachy):

  • object files (.o, o.obj)
  • libraries (.lib)
  • DLLs, shared objects (.so, .dll)
  • Executables (.exe, a.out ?)

GIT ignore files are something I tend to do iteratively. "Hey, I don't need those things in my repo" ...

Edit: re dmckee's comment

Yep, you definately want to be ignoring swap files, temp files etc. I have the following as a baseline for my .gitignore:

  • *.swp
  • .~
  • thumbs.db


You can also setup your build to happen in a subdirectory say build and then you can ignore the whole thing inside .gitignore

build/

And you're done.


I use this in my .gitignoreBut I am building for micro-controllers, so I don't know if it helps you much.

The easiest way to know, is just do a make clean, then add all your files, then do a make all and see what extra stuff appears.

#Some of these are related to eclipse. So i keep them out of my repo.cproject.dep/.project.settings/#files being edited*~# make and build files*.lst*.o*.eep*.lss*.map*.sym# I keep these, since I prefer having the reference of the final build# *.elf# *.hex