Merge two TFS branches with git tfs

后端 未结 3 1748
难免孤独
难免孤独 2021-02-05 14:51

I\'m using git-tfs, and I was wondering if it is possible to merge two TFS branches using git-tfs. I have two branches $/MyCompany/Dev & $/MyCompan

3条回答
  •  一向
    一向 (楼主)
    2021-02-05 15:19

    I found an awesome, if hacky way of doing this. Git tfs manages it's awareness of areas of TFS using git config. Specifically 3 attributes per remote; url, repository and fetch, for example:

    tfs-remote.default.url=http://tfsserver:8080/tfs/collection
    tfs-remote.default.repository=$/Product/Branch/Component
    tfs-remote.default.fetch=refs/remotes/default/master
    

    You can add another remote by setting these 3 properties again with a different name to default. Eg:

    tfs-remote.feature_branch.url=http://tfsserver:8080/tfs/collection
    tfs-remote.feature_branch.repository=$/Product/FeatureBranch/Component
    tfs-remote.feature_branch.fetch=refs/remotes/default/feature_branch
    

    You may need to issue git tfs bootstrap now.

    You can then issue:

    git tfs fetch -i feature_branch
    

    Then merge the commits using:

    git merge tfs/feature_branch
    

提交回复
热议问题