Skip to contentSkip to conversation

Git vs svn. Is ... possible ?

DISCUSSION Rafał Mużyło 5 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Well, the actual question is:
In svn I can do a remote diff (diff between two remote revisions) without having to do a checkout, is this possible for git ?

#1 lore raw
Quoted 3 lines · On Friday, March 28, 2008 at 14:24:38 (+0100) =?utf-8?B?UmFmYcWCIE11xbx5xYJv?=…

Well, the actual question is:
In svn I can do a remote diff (diff between two remote revisions) without having to do a checkout, is this possible for git ?

I'm not sure what you mean by "two remote revisions". Do you mean you are on machine X, and you want to diff content on machine Y and machine Z? If so, you could probably do that in git fairly easily with some script magic that would fetch the remote branches into local tracking branches, and then diff them. This would not literally require you to perform a "checkout", but you would need a git repo (actually a script could take care of creating a temporary repo, fetch into it, do the diff and then remove the temporary repo when done).

If you are talking about having an existing repo on machine X and diffing content that is on machine Y, you can do a fetch followed by a diff, so in that case you can do it literally "without having to do a checkout". Example: if you are working on master and want to see what is different between what you have and what is in a remote repo you are tracking, you can do "git fetch" then "git diff origin/master".

Bill

#2 lore raw
In reply to Rafał Mużyło

Hi Rafał,

Quoted 3 lines · Rafa? Mu?y?o

Well, the actual question is:
In svn I can do a remote diff (diff between two remote revisions) without having to do a checkout, is this possible for git ?

The question makes no sense to me. Git by design is a distributed SCM tool, so there is no such thing like "remote revisions". You can have tracking branches (clones) of some remote repositories, but all the commits on such branches are also stored locally. So you have full access to them, even without a permanent connection to such remote repositories.

And answering to the second part of your question: Yes, you can do "git diff" operation between any of the commits in the repository you are working with. No need to checkout before. You can perform "git diff" even on a bare repository without the working three.

Please refer to "man git-diff" for more info.

BR,
/Adam

PS. The encoding you used for your message is not playing well with the Polish accented characters in your name ;)

Signature · 2 lines
.:.  Adam Piatyszek (ediap)  .:.....................................:.
.:.  [email protected]  .:................................:.
#3 lore raw
Quoted 7 lines · Adam Piatyszek

The question makes no sense to me. Git by design is a distributed SCM tool, so there is no such thing like "remote revisions". You can have tracking branches (clones) of some remote repositories, but all the commits on such branches are also stored locally. So you have full access to them, even without a permanent connection to such remote repositories.

It would certainly be possible to *implement* such a thing, but first question would be, "why would you want to". One of the things that makes git so nice is that repositories don't take that much space, and if you have a local repository (or no network access at all) it's much faster to consult the local repository at all.

In fact, with svn, I normally consider it a bug that you *have* to consult the remote repository to do a diff between two arbitrary revisions.

- Ted

#4 lore raw
In reply to Rafał Mużyło
Quoted 3 lines · Rafa? Mu?y?o

Well, the actual question is:
In svn I can do a remote diff (diff between two remote revisions) without having to do a checkout, is this possible for git ?

You can craft URLs to gitweb in specific ways to do this. For instance:

http://git.complete.org/branches/redmine-integration/?a=commitdiff_plain;h=fb-bug-738-projects-block;hp=upstream

Shows the diff from branch upstream to branch fb-bug-738-projects-block. You can replace the branch names with the full 40-character SHA1 ids as well.

Leave off the "_plain" and you get diff highlighting.

The header at the top of this thing is going to be a bit misleading, but the content is what you want.

-- John