我怎么能列出一个文件的所有不同版本,并区别它们呢? [英] how can I list all the different versions of a file, and diff them also?

查看:132
本文介绍了我怎么能列出一个文件的所有不同版本,并区别它们呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用git,我想列出给定文件的所有不同版本。

然后,我想选择一个特定的版本,并在另一个版本中进行比较。

/ p>

我该怎么做?

解决方案

更改为特定文件,您可以使用 git log

  git log -p -path / to / file 

-p 告诉它显示每个修订版本与其父版本之间的差异。要获得两个修订版本之间的累积差异,请取两个修订版的ID,并将它们传递给 git diff

  git diff abc123 def456  -  path / to / file。 

其中 abc123 def456 是版本ID。


using git, I want to list all the different revisions of a given file.

Then, I want to choose a particular version and compare it when another.

How can I do this?

解决方案

To show a history of changes to a particular file, you can use git log:

git log -p -- path/to/file

The -p tells it to show the diff between each revision and its parent. To get a cumulative diff between two revisions, take the ID of the two revisions, and pass them to git diff:

git diff abc123 def456 -- path/to/file.

Where abc123 and def456 are the revision IDs.

这篇关于我怎么能列出一个文件的所有不同版本,并区别它们呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆