3

I am working (alone) on an application that is a music portal where you can search for artists, songs etc ...

The C# solution consists of:

  • a class library that contains all the stuff to access the web service
  • the application itself

I've recently started using Git and figured out the benefits it does provide to a project but there's something I couldn't figure out, on Visual Studio there is the option to commit a solution which leads me to the following question :

Should I commit each project individually or the whole solution ?

6

A Visual Studio solution is a whole entity. The source control providers work on the solution level. The solution is something that you can compile in itself, for a single project it may not be the case. There can be commits when you need to touch multiple projects at once so that the solution compiles after each atomic commit (especially in your case where there is a breaking change between the two layers). So I'd say it should be the one that you commit.

Although, your project (in a human sense, not VS sense) doesn't have to consist of a single solution. It is not uncommon that you develop a library that can be used by anyone, and you want to publish that as one product in itself. And you also develop an application which uses that library, and publish that as a separate product. From the aspect of the application, your library is not part of the solution, it is an external 3rd party library.

| improve this answer | |
  • Your answer makes sense to me but the thing is if I (also) start committing the solution itself I fear that it becomes confusing. Having an history of the library looks very useful to me as well as one for the application itself (having these is a must IMO). And yes, the library will be put on the web once it is mature enough. I think I'll just create a mini project and see how committing solution and projects cope well together and how reverting would work for such scenario. Thank you. – Aybe Jan 13 '14 at 17:27
0

I run in the same question as yours and here is my way to apply git:

  • for each project folder inside the solution folder, I initialize the git repository.

  • for the solution folder, I also initialize the git repository and add project folders into the .gitignore file of the solution repository.

Although I have commit each project and the whole outside solution individually but I have opportunity to deploy each project in its own edition (UAT, Production, ...).

P.S: I use Git-Bash instead of the Git features of the Visual Studio.

| improve this answer | |
  • Why aren't you using git submodule? – oddRaven Mar 28 '18 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.