![]() We have added our both projects as submodules, and you can see a new file. So as a first step we need to add the submodules to our parent class. So in order to use those the concept of submodule was brought in. Normally while developing project we tend to refer multiple external libraries, which themselves are versioned one. Submodules are nothing they allow you to have repo inside repo. Good thing is it also leads you into a direction of a concept which is called as Submodules. It clearly highlights in case you have repo embedded in repo it will not upload all the contents of the inner repo. It was a warning message and as always, we have ignored it. We were surprised by this, so thought of checking again the steps executed so far. So in this post we will try to demystify and resolve this situation by learning something new.įor people who like to watch instead of reading can checkout this video If you look at screenshot below we can see two projects but none of them is showing any contents. We were expecting everything to be available on remote repo but sadly that is where the real problem starts. Ĭreated a repo on Github and added the remote connection uploaded the stuff. Then as usual staging all content and commiting using below mentioned command Git add. Initializing the parent folder with below mentioned command git init We went ahead with our typical regular follow as mentioned below we thought of making our parent folder also available on GitHub, so that all projects are available at one place. In reality, this is the desired behavior, it's just not immediately intuitive if you're not expecting it.We were having multiple projects in a folder and all pointing to its own remote git repo. It doesn't actually refresh the submodule from it's remote branch, it only refreshes it to whatever level is currently checked into the main repo remote which is not always the latest. ![]() Pulling or Fetching the parent repo can be a little confusing, though. When you commit code to a repo using Tortoise, it notices when a submodule is dirty and will prompt you to check-in the submodule before checking in the parent repo. I usually use commands to add the submodules, but I suspect Tortoise's add submodule functionality works just fine, too. Tortoise seems to provide the easiest and most performant experience when pushing, pulling, and checking in to repos containing submodules. I have tried a number of standalone Git Tools to find the easiest way to manage an environment like this. I would assume that this is fixed in on-prem TFS 2017, as well.Īs was mentioned, Visual Studio itself (the IDE) does still have a hard time understanding submodule relationships. For this reason (among a few others), we are now using VSTS (TFS Online) for everything and have had none of those same types of problems. TFS Build's references to the submodules have a habit of becoming corrupted resulting in builds that stop working without warning until whichever submodule is at fault is completely removed and re-added - not a fun process. Support in on-prem TFS 2015 can be a bit buggy, however. Visual Studio Team Services (TFS Online) and On Prem-TFS (since TFS2015) both now have a good understanding of how submodules work and can now do CI Builds that incorporate submodules right out of the box. Much has changed at Microsoft in relation to Git in the last few years. We have made extensive use of nuget packages for this purpose, as well, but have generally had better success and a much better design/debug experience with submodules. This is helpful since many of our projects can be very large in size and share many of the same chunks of code. We then add each one of those projects as a submodule to any Solution that needs them. ![]() We have found that the easiest way for us to do this is to move each of our shared units of code into their own Visual Studio Project and put each shared Visual Studio project in its own repo. If I'm in one of the non-shared solutions and make a change to something in the submodule, how do I commit and push it back to the shared solution's repo ( SolutionShared) so that it's available to all solutions that reference it? How do I make changes to the shared code from within the non-shared projects Do I simply add its two child projects ( Project1Shared and Project2Shared) in Visual Studio?Ģ. My two solutions now have a SolutionShared directory. I then used TortoiseGit (as I couldn't figure out how to do it Visual Studio) to add that shared repo as a git submodule to Solution1 and Solution2. What I did was to create a new solution SolutionShared, add all my shared code there, and add it to its own git repo. ![]() Most examples use the command line, but I want to do it using Visual Studio 2013 (and/or TortoiseGit)? - SolutionShared I have some shared code I want to share among a number of solutions.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |