Run `git log` on a remote branch
Solution 1
I think your solution is to just look at the history on the github.com website. If you need git log
to work from the command-line then you need your own clone of the repository.
In theory you could write a command-line tool that pulls down commit information from github's API, but this would be restricted to showing just commit messages/metadata, and not actual diffs.
Solution 2
You should fetch the remote branch then interact with it. git fetch
will pull the remote branch into your local repository's FETCH_HEAD, but not your working directory.
git log FETCH_HEAD --decorate=full
will let you see where your HEAD is in comparison to refs/origin/HEAD, which is the remote branch.
git whatchanged FETCH_HEAD --decorate=full
is the same as above, but also shows the files that have changed.
git diff HEAD FETCH_HEAD
diffs between your repository's HEAD and the remote branch's HEAD that you just fetched
git diff --stat HEAD FETCH_HEAD
a summary preview of the changes, just as you would see during the merge and at the bottom of a git pull.
Note that if you do wish to pull in the fetched changes, just do a git merge FETCH_HEAD
. (When you git pull
you are essentially just doing a fetch then a merge)
Solution 3
You could do a shallow clone, which would limit the amount of stuff you'd have to fetch if you only need the recent history:
git clone --depth 100 ...
Solution 4
I've found two ways of doing this with GitHub:
- Use the web API to query the log information (not trivial but doable)
- Use "svn log", since GitHub now partially emulates an SVN server on the Git repositories
Related videos on Youtube
MRocklin
Graduate student in Computational Mathematics at the University of Chicago. Interested in Scientific Computing, Numerical Linear Algebra, Complex Networks, Statistics, and Education.
Updated on September 15, 2022Comments
-
MRocklin about 1 year
I want the output of
git log
of a git repository but I don't want to have to clone the entire repository.I.e. I want something semantically like the following
git log [email protected]:username/reponame.git
If there is a way to do this I'll also want the same for
git whatchanged
If github provides a simple solution for this I would be willing to restrict myself to only git repositories hosted on github.
-
tobixen over 8 yearsThis answer is useless wrg of the actual question asked, but I give it an upvote anyway as it solved the problem I wanted to solve when duckduckgoing for "git log remote branch" :-)