user3776749
user3776749

Reputation: 697

How to merge changes from Github to TFS

So I'm working semi-remotely on a project for a company with a small team. We have only a single VPN-enabled laptop to access their TFS which remains in a single secure office. We want to use Github to collaborate and get all our work onto the company Laptop, and then transfer that work to the company's TFS.

However I can't find a way to merge changes from the Github repo on the laptop to the TFS repo on the laptop without just brute-force ctrl-c/ctrl-v the directory which does not seem like the ideal solution.

Here is the file situation on the laptop with an arrow indicating the desired change transfer

Here is the file situation on the laptop with an arrow indicating the desired change transfer

Is there any clean way to do this?

Upvotes: 1

Views: 758

Answers (1)

Marina Liu
Marina Liu

Reputation: 38096

You can merge changes from github to TFS repo by below steps:

  1. Move files into subfolder in local github repo

    Assume DEV is the subfolder for TFS git repo root directory, you can create the same folder DEV in github repo, and move files in the subfolder:

    # In local github repo
    mkdir DEV
    mv * DEV
    git add . 
    git commit -m 'move files into DEV folder'
    
  2. Add local github repo as a remote for local TFS repo

    Assume the local github repo in C:\GitHub\My_Workflow_Dashboard,then you can add the local repo as the remote for your local TFS git repo:

    git remote add github C:/GitHub/My_Workflow_Dashboard -f
    
  3. Merge changes from github into TFS repo

    Then you can merge the changes from github (such as master branch) to TFS by below commands:

    git merge github/master --allow-unrelated-histories
    git push 
    

    Or you can add -X theirs option (git merge github/master --allow-unrelated-histories -X theirs) to auto resolve merge conflicts by keeping the version from github repo.

Upvotes: 1

Related Questions