9

I'm using Dev-C++ IDE for C programming.

I want to put my project in Github but I'd like to know which type of files should I put there. I mean, the project folder has .o, .layout, .dev (dev-C++ project file), .exe along with source files .c and .h .mkv (make file)

so, which files I should put. If I shouldn't put those file, how should I manage them. I mean my .git file is stored there.. so, when ever there are some files.. it keeps showing me them which are not updated/pushed..

CharlesB
  • 86,532
  • 28
  • 194
  • 218
user1027046
  • 293
  • 1
  • 6
  • 11
  • 3
    Some bit of general advice: If you are not forced to use Dev-C++ I would recommend switching to some other IDE since Dev is buggy and no longer in development. – Sylence Nov 03 '11 at 13:08
  • 3
    My standard link for all Dev-C++ questions: http://stackoverflow.com/tags/dev-c%2b%2b/info – Fred Larson Nov 03 '11 at 13:25

3 Answers3

20

The three big rules of thumb to follow with all source control are:

  • If it's a generated asset, it doesn't go in source control. Otherwise, you're wasting space and needlessly duplicating effort, and you run the risk of stale data. This includes things like object files, compiled project binaries, et cetera.

  • If it contains configuration, keys, passwords, environment variables, etc. that are specific to your machine, it doesn't go in source control. You need to remove anything that's specific to you (references to file paths that won't exist on someone else's machine, etc.).

  • If it's a binary dependency that you don't control (e.g. you depend on glib or NUnit), it also shouldn't go in source control. But you may have no choice if you can't or don't use a package/dependency manager. Ideally it's better if that never lives in your code and you simply have configuration somewhere that says "I depend on NUnit v.2.3.5".

There are exceptions to every rule, of course, but these are some good starting points.

Note that this isn't git-specific; git doesn't care about what files you want to put into source control, and it will let you do anything. You'd probably get the same answer if you were using hg, Subversion, or anything else similar.

John Feminella
  • 303,634
  • 46
  • 339
  • 357
  • 1
    +1. Of course, it is a good idea to include templates/defaults for configuration files. – Fred Foo Nov 03 '11 at 12:57
  • Sound rules. Also, take the habit to build your project in a separate directory, so that only the directory has to be ignored by the source control (it is harder and potentially breaking to hardcode a lot of rules in the .gitignore) – Alexandre C. Nov 03 '11 at 12:58
  • @John: I would argue that, in the absence of a dependency manager (or for a single project), putting the binary dependencies (libraries, images, ...) within the sources control does no harm. hg 2.0 even comes with specific support for those kind of files (largefiles extension). – Matthieu M. Nov 03 '11 at 14:53
  • @MatthieuM.: that's why I said "but you may have no choice" :) – John Feminella Nov 03 '11 at 18:39
4

Usually we put Sourcecode and resources in the repository. OBJ- and BIN-Files should not be put there as they only produce conflicts.

Simple Rule: Don't put files in the repository which are generated dynamicly by your IDE

or in other words:

When you throw away your computer and buy a new one: Which files do you need to continue work?

Ole Albers
  • 8,715
  • 10
  • 73
  • 166
2

We usually put everything into the repository that you need to build the project. So the code files, project files, scripts, resources.

We do NOT put binaries into the repository that can be build by compiling the code. However we put third party binaries into the repository.

All other files, like obj files do not belong there.

Sylence
  • 2,975
  • 2
  • 24
  • 31