Enchantner
Enchantner

Reputation: 1554

Git remote log and changes request

I need to receive the data about revisions, file changes and number of code lines changed without cloning the repo, the only thing I have is a repo url. The only command I found for viewing remote changes is git ls remote, but it's output is too poor. How can I do that?

Upvotes: 4

Views: 3049

Answers (3)

Daniel Egan
Daniel Egan

Reputation: 456

If your repository URL is for a ssh type connection then you can issue a remote log command via ssh, e.g.

If you could have cloned using the command:

git clone username@host:/path/to/repository.git

Then you should be able to issue a log command using:

ssh username@host git --git-dir /path/to/repository.git log

Upvotes: 2

Uberto
Uberto

Reputation: 2712

If you have access to the server, you can run git log locally on the server, parse the data and send back the aggregated result.

Upvotes: 1

Chris Johnsen
Chris Johnsen

Reputation: 224999

There is no way to do what you asked using only the Git protocols.

Depending on how the repository is hosted, you may be able to get some of the information via a web interface. gitweb is distributed with Git and big hosting services often have their own web interfaces.


  • gitweb example: git.git viewing commit tagged 1.7.3.2
    • top links
      • “log” or “shortlog” shows the history leading to the commit
      • “commitdiff” to access diffs against the parent(s)
      • merge/parent abbreviated object name (hex string) moves to that parent
    • per-parent links
      • “diff” link shows the diff against that parent
      • “commit” link moves to that parent
    • “tree” link shows the files as captured in the commit
    • per-file links
      • “diff” (“diffN” for merges) shows the diff of only that file
      • “blob” shows the contents of the file
      • “history” shows the commits leading to the current commit that modify this file

  • GitHub example: git.git viewing commit tagged 1.7.3.2
    • “Commits” tab shows the history
      • “commit”/“parent” abbreviated object name (hex string) takes you to the commit; it shows
        • the files that changed for that commit
          • the green and red squares on the right show the number of lines added/deleted in each file
        • the diffs for the commit
          • “View file” shows the whole file as it was captured in that commit
            • “raw” view/downloads the file
            • “blame” shows the most recent commit to change each line of this file
            • “history” shows the commits leading to the current commit that changed this file

If you are going to be doing any significant digging around in the history it will probably be worth cloning the repository (and it is likely to be the only way if the hosting service does not have a web interface of some kind). You will have to use some disk space but your investigation will not be limited to what the web interface provides and it will be much faster.

One other possibility is git archive; it is an optional server, so it may not be enabled for the server hosting your repository. It allows you to download archives (e.g. tar or zip files) of individual trees. Technically, you could extract such archives and manually diff them to derive the information you are after, but it would likely be more cumbersome and less efficient than just cloning the repository and using the normal tools (i.e. git log with --stat or --numstat with or without -m/-c/--cc).

Upvotes: 6

Related Questions