Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to control multiple framework versions of the same project in git

Let's say I have a Project called Tools.

Tools is a ClassLibrary containing ExtensionMethods, Helpers, etc.

Different products use different references Tools compiled in various .net framework versions.

I've worked with TFS for a long time so I have problems migrating to git.

enter image description here

This is the structure I have on disk AND also in the "Source Control Explorer" in Visual Studio.

I am used to use the Visual Studio GUI to Merge and Branch Changesets across Branches.

enter image description here

I was not able to create a similar environment with git. Where I can push from one branch to the other back and forth.

I would like to have just 1 repository for "Tools" while having the different branches stored on disk (checked out or not).

like image 723
Felix D. Avatar asked Nov 15 '18 09:11

Felix D.


People also ask

How do I manage multiple versions in git?

Probably the easiest way is create branches for each version and then do for example git checkout v1. 0.14 or whatever branch you want to work on. The clients can then also check out the appropriate branch for the one they need as well as when upgrading to next version.

Can a repository have multiple projects?

Yes. You can put multiple projects in one Git repository but they would need to be on different branches within that repo.

What is Github version control?

About version control and Git A version control system, or VCS, tracks the history of changes as people and teams collaborate on projects together. As developers make changes to the project, any earlier version of the project can be recovered at any time.

How do I compare two repositories in Visual Studio?

To compare any two commits in your branch, use the Ctrl key to select the two commits that you want to compare. Then right-click one of them and select Compare Commits. Similar to Commit Details, you can use the Open in New Tab button to open the comparison on a different tab or maximize it on the screen.


1 Answers

I think I understand what you want to accomplish based on your comments and I'll propose a solution but please let me state first that the way TFS and GIT work with branches and merges are quite different. In GIT you don't have the need to download every branch to a separate folder like we used to do with TFS; in GIT you work and switch branches on the same working folder quite easily.

If you need have all the branches checked out to be able to build faster (or whatever) what I propose is:

1) Consider one folder/build as the master/trunk/latest (or any terminology you are familiar with) and use that as the main branch
2) Clone the same repo to different folders, each folder representing the build (branch) you want to use
3) In each folder/repo checkout the branch you are going to be working in
4) You can work with the different branches on these folders and push/pull to all the other ones while having only one repo

Please, I repeat again, this is not the ideal way of working with GIT. If you're using newer versions of Visual Studio the integration with GIT works seamlessly.

like image 163
emmanuel Avatar answered Nov 10 '22 23:11

emmanuel