Forking using TFS Git

I am currently in a project that uses TFS and Git. And I realized that I would no longer be in a quiz state, so I thought I would ask you guys what you think of this as a solution.

The problem I am facing is that I have a "Base" project. This will be reused for each customer. But each client has some modifications (about 5-10%).

I planned to launch project "A" in "Client_A" and make the necessary changes. All classes in which changes can be made are the implementation of abstract classes in "A", so I can synchronize the new version of A if the dependencies are executed.

My problem is that Forking is not supported, we used a bitpack earlier in my team. But since we were integrated with the rest of the company now, we need to run the fact that everyone else works ...

Here is what I think about doing ...

git clone http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/A cd A git fetch origin git branch -a git checkout -b a_branch1 origin/a_branch1 git checkout -b a_branch2 origin/a_branch2 git checkout -b a_branchN origin/a_branchN git branch -a git remote add new-origin http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/Client_A git push --all new-origin git push --tags new-origin git remote rm origin git remote rename new-origin origin 

If I do this, can I still get back to A?

+7
git github tfs git-fork
source share
1 answer

If you remove the upstream remote ( A ), it will not work.

Maybe you need something like

 # 1. create Client_A repo in TFS # 2. get A repo locally git clone http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/A cd A # 3. redefine remotes git remote rename origin upstream git remote add origin http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/Client_A # 4. push to Client A git push origin # 5. push to A (when proper) git push upstream 

The git client cannot create a repository in TFS, you need to do it manually through the web interface or using the TfsGitAdmin utility.

UPDATE: The Fork function is available in VSTS or TFS 2018 and later (see https://docs.microsoft.com/en-us/vsts/git/concepts/forks ).

+9
source share

All Articles