Subject: Re: Does CVS has a easy way to compare file with its previous version?

From: Andreas Ericsson <[email-masked]>
Date: Tue, 30 Jun 2009 13:32:15 +0200

dtletmn wrote:
> Hi,All,
> 
>      I am wondering if cvs has an easy way to compare a file with its
> previous version.
> 
>      In clearcase,I can use  :
>        cleartool diff -pred file.cc
> 
>      how can I acheive it in CVS?
>      any help would be highly appreciated!
> 

Why you're posting this to the git mailing list I have no idea, but
assuming you mean "how do I compare a file in git with the content
it had in the previous snapshot?", the answer would be:

  git diff HEAD^ -- path/to/file

This command works equally well on directories or multiple paths.
Note that if there are no differences, the program will just exit
silently.

If you want to see the differences compared to the *latest* commit,
you'd do

  git diff HEAD -- path/to/file

If you want to see the differences compared to what you've staged
for committing next, you'd do

  git diff -- path/to/file

If you want to see the differences between what you've already
staged and the latest snapshot, you'd do

  git diff --staged -- path/to/file

-- 
Andreas Ericsson                   [email-masked]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.