从main创建分支(包括本地更改),或从架子集中创建分支

时间:2019-09-02 09:14:18

标签: tfs visual-studio-2017 branch tfvc

我已经在我们的主分支工作了一段时间,但是现在意识到更改更加全面,应该改为在dev分支中进行开发。

因此,我想从main分支创建一个dev分支,并将main中的本地修改移到该分支。似乎已经可以使用tfpt命令使用VS和TFS的较早版本,但是我无法找到如何在较新的环境中完成此操作的方法,我的计算机上装有VS2019专业版,并且我们使用的是TFS 2017。 (旧的解决方案已在here中进行了描述。)

如果可以通过修改或采用不错的技巧采用前面描述的过程,那么对此的使用方法当然将受到高度赞赏。

3 个答案:

答案 0 :(得分:0)

正如您所说,coords = {} coords_file = csv.reader(open(coordinate_location)) for row in coords_file: coords[row[0]] = [float(row[1]),float(row[2])] # open output file output_file = csv.DictReader(open(output_location)) # turn detections into polygons for row in output_file: img_name = row['filename'] detection_class = row['type'].strip() confidence = row['confidence'] #combo = row['filename'] + row['type'] #detection_type = detection['tool_label'] if detection_class == 'celtic_field': detectionDict = { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [] }, "properties": { "detection_type": detection_class, "confidence": confidence } } polyCoords = [] coordinate_x_1 = coords[img_name][0] + float(row['xmin']) * 0.5 coordinate_x_2 = coords[img_name][0] + float(row['xmin']) * 0.5 coordinate_x_3 = coords[img_name][0] + float(row['xmax']) * 0.5 coordinate_x_4 = coords[img_name][0] + float(row['xmax']) * 0.5 coordinate_y_1 = coords[img_name][1] - float(row['ymin']) * 0.5 coordinate_y_2 = coords[img_name][1] - float(row['ymax']) * 0.5 coordinate_y_3 = coords[img_name][1] - float(row['ymax']) * 0.5 coordinate_y_4 = coords[img_name][1] - float(row['ymin']) * 0.5 polyCoords.append([coordinate_x_1,coordinate_y_1]) polyCoords.append([coordinate_x_2,coordinate_y_2]) polyCoords.append([coordinate_x_3,coordinate_y_3]) polyCoords.append([coordinate_x_4,coordinate_y_4]) polyCoords.append([coordinate_x_1,coordinate_y_1]) detectionDict['geometry']['coordinates'].append(polyCoords) output['features'].append(detectionDict) 命令是Visual Studio Power Tools的一部分,而VS 2019则不存在。

作为解决方法,您可以执行以下操作:

1)将所有更改的文件复制到另一个位置(本地)。

2)撤消挂起的更改。

3)创建新分支。

4)在本地删除更改文件,然后在其中复制新文件(在步骤1中备份的文件)。

5)签入更改。

答案 1 :(得分:0)

根据您在问题中分享的描述和解决方案。实际上,这是在讨论如何将货架集扩展到TFS中的另一个分支。

在不使用tfpt unshelve /migrate命令的情况下,在Visual Studio 2019中没有更好的方法

在您的情况下,解决此问题的一个不明智的解决方法应该是:首先在main分支上备份本地文件,撤消待处理的更改,基于main分支创建一个新的dev分支。从dev分支的服务器端获取最新版本到您的工作区。

然后将您的备份文件/文件夹从main分支复制到新的dev分支。 Windows系统将判断替换文件并添加新文件。(这可能需要一些时间)。此后,TFS系统将自动检测本地更改,并将其列为dev分支的新待处理更改。某些新添加文件可能会保留在“排除”列表中,而在“包括”列表中手动升级它们。

在此之后,您还可以考虑使用Git。如果您使用的是GIT,这很简单。在UI中创建新分支后,只需对新分支进行“签出”。任何未提交的更改将自动指向新分支。然后,您可以将它们提交在那里。

答案 2 :(得分:0)

您可以通过执行以下操作在 Visual Studio 中完成此操作:

  1. 选择“团队资源管理器”标签
  2. 选择顶部的“主页”图标
  3. 选择“更改”
  4. 点击“Stash”=>选择“Stash All”
  5. 创建你的开发分支,或者如果存在就切换分支
  6. 在“Stashes”部分右键单击“WIP”=> 将鼠标悬停在“Apply”上=> 选择“Apply All as Unstaged”