GIT version control and .NET solutions
Independ of the company size often some functionality is stored in a library which is shared between multiple solutions. There may be, for instance, multiple website solutions which talks to the same database. In this case there is a data library ( C# project ) with functionality to store, query and update the database wich is shared between the different solutions. This is a logical structure found everywhere in all sorts of C# development environments. Looking at the some Version Control systems like, subversion or TFC version control this is easily supported. GIT, on the other hand, is a complete different story. GIT is folder based. With this is mind there are two options to store these kind of solutions in the version control.
- Store your complete folder structure with all solutions in a single repository.
- Store every .NET solution in a single repository and work with GIT submodule's.
Storing you compleet development environment as a single repository into GIT is the most simple solution. On the other hand creating a repository for every .NET solution feels better. In that case you will have to work with GIT submodules. GIT submodules is supported by VisualStudio but still forces you to use the GIT command:
Create a GIT submodule
- From the parenbt project open Git Command prompt en voer de volgende commando's uit
- Git submodule add "hier de url uit TFS van de submodule"
- Git submodule init
- Git submodule update
Bind the submodule to a branch
Be aware: the submodule is not yout bounded to a remote branch. We first have to bind th e submodule to a remote branch by connecting via the parent project en from the Git command promt to execute the checkout command: Git Checkout Master. After this check with Git command: check status the binding of the submodule.
How to commit a GIT submodule
- Add all changes by executing : Git Add .
- Commit all changes locally by executing: Git commit -a -m "hier commit message"
- Push all changes to server by exectuing: Git push
After that you can now push all your changes with one command:
- - git push --recurse-submodules=on-demand
GIT submodule and branches
Be aware that when you are working in a specific branch in a parent project you will have to manually create and changes the branch of the subModule.
Git push --set-updstream origin 'nieuwe branchname'
Conclusion of GIT submodules
Not sure yet..... :-)