Murtaza Pitalwala
Murtaza Pitalwala

Reputation: 899

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

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?

Upvotes: 64

Views: 41945

Answers (5)

Anurag Kanungo
Anurag Kanungo

Reputation: 354

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.

Upvotes: 16

DaWe
DaWe

Reputation: 1702

The --bare and --filter=blob:none options gives you the full logs while omitting the objects thus minimizing space for commit history.

Combining with --depth=1 and --single-branch reduces network traffic even further by only downloading the last commit on the default (usually main) branch:

git clone --bare --filter=blob:none --depth=1 --single-branch REPO_URL

Upvotes: 2

JR ibkr
JR ibkr

Reputation: 919

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

Upvotes: 0

Noob
Noob

Reputation: 314

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.

Upvotes: 29

aust
aust

Reputation: 914

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

Upvotes: 19

Related Questions