Is it possible to get commit logs/messages of a remote git repo without git clone

31,970

Solution 1

If you are looking to see the last few commits of a branch, try:

git clone -b [branch name] --single-branch [repo url] --depth=3

This will clone only the last 3 commits on the branch you are interested. Once done you can get into the cloned repo and view the history.

Solution 2

There is no way to view a remote log using git log without having a local (cloned) copy. You will need to clone the repository then do what you are wanting. Once cloned, you can then fetch different remotes and do a git log <remote>/<branch>. An alternative method would be to use software on the server that would allow you to view remote git history through some type of service (such as Stash, GitHub Enterprise, etc.)

See Commit history on remote repository

If you'd like to read more about it, this is a great resource: http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History

Solution 3

Not the exact, but a way around.

Use GitHub Developer API

1. Opening this will get you the recent commits.

    https://api.github.com/repos/learningequality/ka-lite/commits

    You can get the specific commit details by attaching the commit hash in the end of above url.

2. All the files ( You need sha for the main tree)

    https://api.github.com/repos/learningequality/ka-lite/git/trees/7b698a988683b161bdcd48a949b01e2b336b4c01

I hope this may help.

Solution 4

I came across this problem. In my case, I had access .git file. I was able to extract information from it using following:

git --git-dir=path/to/your/xyz.git log
Share:
31,970

Related videos on Youtube

Murtaza Pitalwala
Author by

Murtaza Pitalwala

Updated on April 01, 2020

Comments

  • Murtaza Pitalwala
    Murtaza Pitalwala about 4 years

    Is it possible to get commit logs/messages of a remote git repo without git clone?

    The git repo I am working with is huge, even if I run git clone with --depth=1 still takes sometime before I am able to clone it.

    I am looking for something like this,

    git remote-log .

    I have also looked in to git -ls-remote, which only provides the SHA and the Heads/tags. I am interested in getting the last 2 commit title, commit user and commit SHA?

    Anyone know how to do that?

    • user541686
      user541686 about 6 years
      I can't believe this is not possible. This is ridiculous. SVN is better than this...
  • Murtaza Pitalwala
    Murtaza Pitalwala over 10 years
    Hello Aust, if the repository is huge and all I want to see who commited last, what was the commit title and the SHA, I would still have to download all the files?
  • aust
    aust over 10 years
  • Murtaza Pitalwala
    Murtaza Pitalwala over 10 years
    Ok Thanks for the help. Since there is no way of doing it, I will accept your 'answer'
  • Murtaza Pitalwala
    Murtaza Pitalwala over 9 years
    Thanks Noob for the help. I will accept this as an answer, but I was just wondering if there is a way to look at the git log without downloading the whole repo itself or downloading just the logs of the repo instead of full repo.
  • juanmf
    juanmf almost 6 years
    --depth Implies --single-branch unless --no-single-branch is given :D
  • Att Righ
    Att Righ almost 6 years
    No is a strong world :P. I'd point out that this is technically possible. Git uses git-fetch-pack which can fetch individual git objects and git-ls-remote to the names of objects (this page discusses the types and relations of git objects) you could in theory use this to fetch any subset of git you want.
  • joveyol
    joveyol over 5 years
    I would only add to this --bare, so that the working files are not also copied/checked out.
  • Flak DiNenno
    Flak DiNenno almost 2 years
    isn't this extracted the local repo log info only?
  • Flak DiNenno
    Flak DiNenno almost 2 years
    this should be the accepted answer. It may not work on ALL git remote branches, but definitely gives you what you want on Github!