Question

I have two hashes and an URL of a git remote repository. How to perform a diff?

With SVN I do it this way:

svn diff -rXXX:YYY svn+ssh://host/path
Was it helpful?

Solution

This is not possible without cloning the entire repository beforehand, due to the way git works. After cloning you can create the diff like this:

git diff <from>..<to> -- <filename>

<from> and <to> may be some “commitish”, so tags, branches and everything else that can be resolved to a commit will work as well.


If you want to save some traffic and know for sure that both commits are inside the last hundred commits you may use:

git clone --depth 100 <repository>

This will only clone the newest 100 commits. Please note that it will be impossible to push or pull from this clone afterwards!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top