1

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?

davidrmcharles
  • 1,923
  • 2
  • 20
  • 33
  • 1
    `git difftool` lets users see changes in their preferred diff tool. – mipadi Aug 19 '15 at 20:17
  • See also: ["How do I configure git to use a different tool for diffing ..."](https://stackoverflow.com/questions/6412516/configuring-diff-tool-with-gitconfig) – Chris Martin Aug 19 '15 at 21:28

1 Answers1

1

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.

Roland Smith
  • 42,427
  • 3
  • 64
  • 94