* Does CVS has a easy way to compare file with its previous version?
@ 2009-06-30 7:41 dtletmn
2009-06-30 11:32 ` Andreas Ericsson
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: dtletmn @ 2009-06-30 7:41 UTC (permalink / raw
To: git
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!
Thanks,
dt
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-06-30 7:41 Does CVS has a easy way to compare file with its previous version? dtletmn
@ 2009-06-30 11:32 ` Andreas Ericsson
2009-06-30 12:36 ` Jakub Narebski
2009-07-01 0:29 ` dtletmn
2 siblings, 0 replies; 10+ messages in thread
From: Andreas Ericsson @ 2009-06-30 11:32 UTC (permalink / raw
To: dtletmn; +Cc: git
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 andreas.ericsson@op5.se
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-06-30 7:41 Does CVS has a easy way to compare file with its previous version? dtletmn
2009-06-30 11:32 ` Andreas Ericsson
@ 2009-06-30 12:36 ` Jakub Narebski
2009-06-30 23:28 ` Paolo Bonzini
2009-07-01 0:29 ` dtletmn
2 siblings, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2009-06-30 12:36 UTC (permalink / raw
To: dtletmn; +Cc: git
dtletmn <dtletmedn@gmail.com> writes:
> 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!
In CVS or in Git?
In CVS: "cvs diff -r <previous revision> <file>".
In Git: "git diff HEAD^ -- <file>".
Both assume that you want to compare with version from previous
commit.
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-06-30 12:36 ` Jakub Narebski
@ 2009-06-30 23:28 ` Paolo Bonzini
2009-07-01 1:18 ` Linus Torvalds
0 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2009-06-30 23:28 UTC (permalink / raw
To: Jakub Narebski; +Cc: dtletmn, git
On 06/30/2009 02:36 PM, Jakub Narebski wrote:
> dtletmn<dtletmedn@gmail.com> writes:
>
>> 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!
>
> In CVS or in Git?
>
> In CVS: "cvs diff -r<previous revision> <file>".
> In Git: "git diff HEAD^ --<file>".
I think he wants something more like
git diff `git log -2 --pretty=format:%h` <file> -- <file>
In CVS it should not be hard, but I definitely have no idea.
Paolo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-06-30 7:41 Does CVS has a easy way to compare file with its previous version? dtletmn
2009-06-30 11:32 ` Andreas Ericsson
2009-06-30 12:36 ` Jakub Narebski
@ 2009-07-01 0:29 ` dtletmn
2 siblings, 0 replies; 10+ messages in thread
From: dtletmn @ 2009-07-01 0:29 UTC (permalink / raw
To: git
Thanks all very much for the help!!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-06-30 23:28 ` Paolo Bonzini
@ 2009-07-01 1:18 ` Linus Torvalds
2009-07-02 18:04 ` Eric Raible
0 siblings, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2009-07-01 1:18 UTC (permalink / raw
To: Paolo Bonzini; +Cc: Jakub Narebski, dtletmn, git
On Wed, 1 Jul 2009, Paolo Bonzini wrote:
>
> I think he wants something more like
>
> git diff `git log -2 --pretty=format:%h` <file> -- <file>
That's a rather difficult way of saying
git log --no-merges -p -1 <filename>
which seems much simpler. Sure, you'll get the commit message too, but
that just sounds like gravy to me (you can use "--pretty=oneline" or
something to make it denser).
Linus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-07-01 1:18 ` Linus Torvalds
@ 2009-07-02 18:04 ` Eric Raible
2009-07-03 6:39 ` Paolo Bonzini
0 siblings, 1 reply; 10+ messages in thread
From: Eric Raible @ 2009-07-02 18:04 UTC (permalink / raw
To: git
Linus Torvalds <torvalds <at> linux-foundation.org> writes:
> On Wed, 1 Jul 2009, Paolo Bonzini wrote:
> >
> > I think he wants something more like
> >
> > git diff `git log -2 --pretty=format:%h` <file> -- <file>
>
> That's a rather difficult way of saying
>
> git log --no-merges -p -1 <filename>
>
> which seems much simpler. Sure, you'll get the commit message too, but
> that just sounds like gravy to me (you can use "--pretty=oneline" or
> something to make it denser).
>
> Linus
Isn't the first one incorrect because <file> needs to be inside the backticks?
git diff `git log -2 --pretty=format:%h <file>` -- <file>
And isn't the replacement incorrect also (the diffs are backwards)?
git log --no-merges -p -R -1 <file>
- Eric
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-07-02 18:04 ` Eric Raible
@ 2009-07-03 6:39 ` Paolo Bonzini
2009-07-06 23:39 ` Eric Raible
0 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2009-07-03 6:39 UTC (permalink / raw
To: Eric Raible; +Cc: git
On 07/02/2009 08:04 PM, Eric Raible wrote:
> Isn't the first one incorrect because<file> needs to be inside the backticks?
> git diff `git log -2 --pretty=format:%h<file>` --<file>
>
> And isn't the replacement incorrect also (the diffs are backwards)?
> git log --no-merges -p -R -1<file>
Yes and no.
Paolo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-07-03 6:39 ` Paolo Bonzini
@ 2009-07-06 23:39 ` Eric Raible
2009-07-07 19:57 ` Paolo Bonzini
0 siblings, 1 reply; 10+ messages in thread
From: Eric Raible @ 2009-07-06 23:39 UTC (permalink / raw
To: Paolo Bonzini; +Cc: git
On Thu, Jul 2, 2009 at 11:39 PM, Paolo Bonzini<bonzini@gnu.org> wrote:
> On 07/02/2009 08:04 PM, Eric Raible wrote:
>>
>> Isn't the first one incorrect because<file> needs to be inside the
>> backticks?
>> git diff `git log -2 --pretty=format:%h<file>` --<file>
>>
>> And isn't the replacement incorrect also (the diffs are backwards)?
>> git log --no-merges -p -R -1<file>
>
> Yes and no.
>
> Paolo
>
Are you sure that you didn't mean yes and yes?
As the transcript shows the git-diff form produces a
backwards diff. Thus to get the same output git-log
needs the -R:
$ git init
$ perl -e 'for (0..10) { print "$_\n" }' > file
$ git add file
$ git commit -minitial
[master (root-commit) 2d451ec] initial
1 files changed, 11 insertions(+), 0 deletions(-)
create mode 100644 file
$ sed -e 's/4/four/' < file > file1
$ mv file1 file
$ git commit -a -m'updated'
[master d49613a] updated
1 files changed, 1 insertions(+), 1 deletions(-)
$ git diff `git log -2 --pretty=format:%h file` -- file
diff --git a/file b/file
index b29b605..b033488 100644
--- a/file
+++ b/file
@@ -2,7 +2,7 @@
1
2
3
-four
+4
5
6
7
$ git log --no-merges -p -1 file
commit d49613a1d16c9ece551f9a52f56f16a3dae8bebc
Author: Eric Raible <raible@nextest.com>
Date: Mon Jul 6 16:25:29 2009 -0700
updated
diff --git a/file b/file
index b033488..b29b605 100644
--- a/file
+++ b/file
@@ -2,7 +2,7 @@
1
2
3
-4
+four
5
6
7
$ git log --no-merges -p -R -1 file
commit d49613a1d16c9ece551f9a52f56f16a3dae8bebc
Author: Eric Raible <raible@nextest.com>
Date: Mon Jul 6 16:25:29 2009 -0700
updated
diff --git b/file a/file
index b29b605..b033488 100644
--- b/file
+++ a/file
@@ -2,7 +2,7 @@
1
2
3
-four
+4
5
6
7
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Does CVS has a easy way to compare file with its previous version?
2009-07-06 23:39 ` Eric Raible
@ 2009-07-07 19:57 ` Paolo Bonzini
0 siblings, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2009-07-07 19:57 UTC (permalink / raw
To: Eric Raible; +Cc: Paolo Bonzini, git
On 07/07/2009 01:39 AM, Eric Raible wrote:
> On Thu, Jul 2, 2009 at 11:39 PM, Paolo Bonzini<bonzini@gnu.org> wrote:
>> On 07/02/2009 08:04 PM, Eric Raible wrote:
>>> Isn't the first one incorrect because<file> needs to be inside the
>>> backticks?
>>> git diff `git log -2 --pretty=format:%h<file>` --<file>
>>>
>>> And isn't the replacement incorrect also (the diffs are backwards)?
>>> git log --no-merges -p -R -1<file>
>> Yes and no.
>>
>> Paolo
>>
>
> Are you sure that you didn't mean yes and yes?
I'm sure; I'm not sure I was right (though I did retest at the time, and
I was convinced that Linus's alternative worked).
Paolo
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-07-07 19:58 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 7:41 Does CVS has a easy way to compare file with its previous version? dtletmn
2009-06-30 11:32 ` Andreas Ericsson
2009-06-30 12:36 ` Jakub Narebski
2009-06-30 23:28 ` Paolo Bonzini
2009-07-01 1:18 ` Linus Torvalds
2009-07-02 18:04 ` Eric Raible
2009-07-03 6:39 ` Paolo Bonzini
2009-07-06 23:39 ` Eric Raible
2009-07-07 19:57 ` Paolo Bonzini
2009-07-01 0:29 ` dtletmn
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).