Show git logs for a range of commits on a remote server?

I am looking for a way to request a git server for my logs for a given range of commits. Being an SVN user, I am wrong, so I hope git experts can help. I am looking for something similar to:

svn log -r 5:20 --xml svn.myserver.com 

but for git server. In other words, show me the magazines for the 5th gear up to the 20th commitment. Thanks for any help.

+7
source share
2 answers

First, since there is no simple version number with Git, you must specify the revision specified in the rev-parse command.

But the only command that directly requests a remote repo (without cloning or fetching data) is git ls-remote and:

  • only SHA1 will be displayed, not a log message.
  • it works with ref patterns (head, tags, branches, ...), not revs.

Since a log can display diffstats and complete differences, you cannot query logs without at least getting deleted in a local repo.

+17
source

I think you are trying to transfer some assumptions from Subversion that are not valid for git. Git is a decentralized version control system, so all commandsΒΉ work against your local repository clone, not from a remote server. In addition, there is no single linear commit history in git, so you need to specify SHA-1 commit identifiers; you cannot just use version numbers.

To get the log, you must first transfer the commits to the local repository clone, and then you can request them.

If you have not cloned the remote repository yet, you need to run git clone REMOTE_URL . Alternatively, if you want to use an additional remote server, you can run git remote add ALIAS OTHER_REMOTE_URL in the existing repository.

Then you need to get commits using git fetch origin (or git fetch ALIAS if you added an additional remote server).

Once you do this, you can list the commits (in branches in the remote repository) using git log origin/master~5..origin/master (for example, to display the last five commits). Or you can run git log master..origin/master to show new remote commits that have not yet been merged locally. (There are many other ways to specify commit ranges; for more information, see the documentation or open another question.)


  • Some commands, such as git ls-remote , are executed on a remote server, but most do not.
+6
source

All Articles