Dejv
Dejv

Reputation: 954

Should initial Git commit contain auto generated files?

So far I was developing without versioning software and my application contains many files (functionality, configuration files and auto-generated files). Now another two people will be working on this project so I want to use Git for our cooperation.

I'm new to Git. I just set up Git repository on my server. I want to develop on my notebook and then commit changes to the server. Now I'm not sure about how the first commit should look.

Should I include all the files (auto-generated files, config files and functionality files) into first commit, so my colleagues could easily checkout and get full project data to their localhosts or should I commit only functionality files (exclude pictures, auto-generated files, configuration files, etc.) ?

If I commit everything, they can checkout and then ingnore config files (because they have to edit them to fit their localhost environment) and auto-generated files from future commits.

What is the best practise for this? Thank you.

Upvotes: 3

Views: 647

Answers (1)

Trudbert
Trudbert

Reputation: 3198

The best practice would be to create a .gitignore file ignoring backups, compiled files, host dependent files, ide dependent files and stuff you don't want in the global repository because they don't make sense there. Only the stuff necessary to compile and run the project should be in your repository (and perhaps some project management stuff like gloabal todo lists, instructions, readme etc.).

Global, stable config file (like makefiles, maven pom and such) of course should be included since they are needed to build the project.

Make your first commit including this gitignore and not the files you don't want.

Once the host specific files and such are in the repository they are in the repository and they will make trouble (i.e overwrite new configs on checkout and stuff like this) unless deleted from the repository. So the easiest and safest way to deal with it is not include them at all.

Upvotes: 3

Related Questions