1

I apologize in advance for asking this question which might seem extremely confusing.

I've created a repository a while back and just reformatted my computer so I'm trying to get all my files back. However, when I created this repository (https://github.com/F-Tahir/BMRCalculator), I only source controlled the files in the java project's src folder (is this the correct way to do it?).

I want to source control the entire java project folder (so the bin folder, an extra images folder I added, etc). Is this a good approach to do or should I only source control the src folder?

If so, how can I go about adding these extra folders and still keep the old commit history? I can do it by creating a new repository but then I wouldn't have any old commits.

Thanks

Mifeet
  • 12,949
  • 5
  • 60
  • 108

1 Answers1

1

Put all text files that need to be versioned to your version control. This typically includes your src directory, configuration files, pom.xml files if you're using Maven, etc.

It is not a good idea to put binary files to your source control if they are large and/or change frequently and definitely don't put there generated files like target. The reason is that version controls like git version file by tracking diffs between versions which doesn't work well for binary files. They clutter your history and often lead to huge repositories taking a lot of space with history of binary files.

There is no strict rule about binaries in version control, though. some people even support it. If your binary files are small and stable (e.g. images in a web project), it should be OK to just include them.

What to do about your binary files depends on what they are. There are repositories like Nexus for jar packages. There are repositories for unix packages (e.g. rpms). If they are large files, put them to a dedicated location which is backed up.

The last option (that I admit to using once or twice too) would be setting up a different repository for your binary files and limit the history there so that it doesn't take up too much space but you would be just (kind of) misusing git as a backup tool.

You can also check out a few related questions:


Update after looking at your repository:

  • Usually I don't put IDE settings (.settings, .project, and .classpath generated by Eclipse) to source control because they often change. Because nothing else contains the project information in your case, I would recommend using Maven instead.
  • Move bin/README.md to your root directory.
  • Remove bin directory. It contains duplicated images and .class files. They are automatically generated by your IDE so they don't contain new information and change frequently.
Community
  • 1
  • 1
Mifeet
  • 12,949
  • 5
  • 60
  • 108
  • Thanks for the reply. I updated my git repository - what would you recommend I remove? The link is in the OP. –  Sep 08 '15 at 16:07