0

I need to merge changes from a remote tfs repository branch into a git repository branch.

Cloning would create a whole new git repository, which I don't want. I want to merge into an existing git repository.

Clarification:

  • A couple of weeks ago, a colleague cloned 2 TFS repositories: RepoA, RepoB
  • That colleague left the company.
  • We decided we wanted a single repository, so I merged RepoA into RepoB as described here: Merge two Git repositories without breaking file history
  • Since then, all development teams have been using RepoB, except one.
  • One team continued to develop and commit into the TFS repository.
  • Now we want to get that final team to start using Git; we need to merge their work since the original clone (tfs-RepoA) into the Git repository (RepoB)
Community
  • 1
  • 1
Vyskol
  • 298
  • 3
  • 11
  • 1
    Your question is not enough clear and it's difficult to read between the line :-( Could you explain what you did to arrived here and more clearly what you want and why. I explained all I can in the [git-tfs documentation about branches](https://github.com/git-tfs/git-tfs/blob/master/doc/usecases/manage_tfs_branches.md#merge-2-branches-and-checkin-this-merge-in-tfs) – Philippe Jul 17 '15 at 18:43
  • 1
    You should be able to add the TFS remote to the repo B, and use `git tfs fetch` to fetch the changes there. If the original commits of TFS repo B were not changed in your merge, and if the TFS remote has the same name, then git-tfs should pick up from where it’s left off, so it should only fetch the new changes. Afterwards, you can merge the branch in again. – poke Jul 18 '15 at 00:53
  • @poke How do I add the TFS remote to RepoB? – Vyskol Jul 18 '15 at 01:38
  • 1
    Try [git tfs bootstrap](https://github.com/git-tfs/git-tfs/blob/master/doc/commands/bootstrap.md) from a branch that contains commits from Ⓑ only. – poke Jul 18 '15 at 01:56

1 Answers1

1

We decided we wanted a single repository, so I merged RepoA into RepoB as described here: Merge two Git repositories without breaking file history

I don't understand well what you did here but I will assume that this operation was not too destructive ;)

I assume also (if I understand well) that the team that still use TFVC is committing in a branch that was cloned in the RepoA.

The first thing you have to do is to verify that you still have the git-tfs metadata needed by git-tfs in the commits comming from the RepoA. They should look like git-tfs-id: [https://yourtfs/tfs/TFS16]$/vtccds/trunk;C26497

Since you found these commits, then checkout a branch on the last one retrieved from TFS.

If you have version of git-tfs higher than v0.20 (update if needed), you then just need to do a git tfs fetch. If you have an old version, a git tfs bootstrap is required before doing the fetch...

If all works well, after a long time, you should have all the commits corresponding to the changesets of the team committing on TFS.

Then, you are able to do what you want with it and merge the branch...

Philippe
  • 28,207
  • 6
  • 54
  • 78