Beau Johnny Bekkestad Beau Johnny Bekkestad - 3 years ago 256
Git Question

Forking using TFS Git

I'm in a project now that uses TFS and Git. And i've realized that i am not going to be able to Fork anymore so i thought i would ask you guys what you think about this as a solution.

The problem i am having is that i have a "Base" project.That would be reused for every client we have. But each client has modifications to some extent (about 5-10%).

I was planning to Fork project "A" into "Client_A" and make the changes needed.
All the classes where changes can be made are implementations of Abstract classes in "A", so i would be able to sync a new version of A as long as dependencies are met.

My problem now is that Forking is not supported, we were using bitbucket before in my team. But since we were integrated with the rest of the company now we need to run what everyone else is running...

This is what i am thinking about doing...

git clone 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 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 will i still be able to upstream to A?

Answer Source

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

Probably you want something like

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

Git client cannot create the repository in TFS, you need to do it manually via the Web interface or using my TfsGitAdmin utility.

UPDATE: The Fork feature is available in VSTS or TFS 2018 and later (see

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download