简体   繁体   English

从 tfvc 迁移后同步 git 个分支

[英]Sync git branches after migration from tfvc

How can I sync branches after migration from tfvc so that ahead|behind is 0|0?从 tfvc 迁移后如何同步分支,使 ahead|behind 为 0|0?

The branches are identical in contents but with different history.这些分支的内容相同,但历史不同。

We are using Azure DevOps.我们正在使用 Azure DevOps。

git merge syncs up the branches perfectly but also merges in all the commits which is not optimal. git merge完美地同步了分支,但也合并了所有不是最佳的提交。

git merge --squash results in nothing to commit and push. git merge --squash不会提交和推送任何内容。

Suggestions?建议?

在此处输入图像描述

When you are only ahead, syncing a branch is end up to only doing a push.当您只领先时,同步分支最终只是进行推送。

When you are ahead and behind and you don't mind loosing the commits already pushed in the remote (the behind ones) , you need to force push.当你领先和落后并且你不介意丢失已经推送到远程(后面的)的提交时,你需要强制推送。

I don't know exactly where this option is in Visual Studio (and I'm not in front of my computer ) but from the command line, it should be (if your remote is origin which is most of the times the case):我不知道这个选项在 Visual Studio 中的确切位置(而且我不在我的电脑前)但是从命令行,它应该是(如果你的遥控器是origin ,大多数情况下都是这样):

git push --force origin dev

Same for your other branches like 'test'.对于你的其他分支,如“测试”,也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM