简体   繁体   English

Visual Studio Git:复制文件并保留历史记录

[英]Visual Studio Git: copy files and keep history

Is there a way for a Visual Studio user to copy a bunch of files from one location to another and keep the history of both versions? Visual Studio 用户有没有办法将一堆文件从一个位置复制到另一个位置并保留两个版本的历史记录?

I found the answer https://stackoverflow.com/a/44036771/1520078 , which may solve the problem for single files, but I want to copy hundreds of files, preferredly not having to rename each single one.我找到了答案https://stackoverflow.com/a/44036771/1520078 ,它可以解决单个文件的问题,但我想复制数百个文件,最好不必重命名每个文件。

As noted in comments, files in Git do not have history.如评论中所述,Git 中的文件没有历史记录。 History, in Git, is nothing but commits: the commits are the history, and each commit has a full copy of every file.在 Git 中,历史就是提交:提交就是历史,每次提交都有每个文件的完整副本。

What this means is that any viewer that purports to show "file history" is lying .这意味着任何声称显示“文件历史”的查看器都是在撒谎 It may do a very good job of lying, by using commit history to find exactly what you mean by "file history", or it may do a poor job of lying, by showing you something you don't mean at all.它可能在撒谎方面做得很好,通过使用提交历史来准确找到所说的“文件历史”,或者它可能在撒谎方面做得很差,通过向您展示一些您根本不想要的东西。 But it definitely has to lie because there is no file history, there is only commits-as-history.但它肯定是在撒谎,因为没有文件历史记录,只有作为历史记录的提交。

Each Git commit viewer has its own method(s) of lying to produce file history, since users like to see file history.每个 Git 提交查看器都有自己的方法来生成文件历史记录,因为用户喜欢查看文件历史记录。 But each viewer tends to do it a little differently.但每个观众的做法往往略有不同。 Find a viewer you like, and use that one.找到您喜欢的查看器,然后使用该查看器。

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

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