简体   繁体   中英

How to get git diff between tags on repository without cloning/checkout

I would like to know if there is a possibility to make something like:

git diff --repository ssh://git@server/repository.git TAG1 TAG2

I know that you want to ask: "Why don't you simply clone the repo and then make typical diff?"

Well, I want to make a script that will iterate through dozens of repositories as fast as possible in order to find changed that I have interest in. This script will be used by many people so I would really like to avoid slowing it down by downloading each repository.

So, my final question: is there anything that can do such a diff?

I don't think it can be done.

Git does not store differences between commits (as many explanations have you believe), but actually stores the different versions of an object. (It does compress these different versions together, yielding something similar to differences, though).

In order to present you with the typical git diff output, git actually compares the objects on-demand, and calculates the differences.

I don't see how this can be done without checking out (at least partially) the repository to have the objects to compare. Or have the server cooperate by having the diff calculated at the server end (as suggested in the comments with GitHub/BitBucket specific options).

If you want to minimise the amount of data to transfer, you could look in to shallow clones .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM