Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
784 views
in Technique[技术] by (71.8m points)

git - how can I list all the different versions of a file, and diff them also?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...