davidrmcharles
davidrmcharles

Reputation: 1953

What is the Git equivalent of cvs checkout -p?

Git's diff is quite good, but I think my users would prefer to see differences in the tool of their choice. How can I acquire an untracked copy of a file from the local repository that represents file in its pristine condition, prior to any user changes?

With CVS, I could acquire the base revision of the user's file and then issue a cvs checkout -r base.rev -p >/tmp/some-file command. How does one do something like that in Git?

Upvotes: 1

Views: 124

Answers (1)

Roland Smith
Roland Smith

Reputation: 43495

First, look up what the first committed version of a file was;

git log --follow --stat <filename>

Using --follow is necessary to catch renames. Using --stat will show you the original filename.

Remember the commit and original filename of the first commit. Then;

git checkout <commit> <original filename>

That will give you the first version that was checked in.

Upvotes: 1

Related Questions