I am trying to access a branch's commit history on a remote repository. I had a look at the doc but could not find any substantial information on how to access a remote repo's commit history using my local git client.
On GitHub, you can see the commit history of a repository by: Navigating directly to the commits page of a repository. Clicking on a file, then clicking History, to get to the commit history for a specific file.
The git fetch command downloads commits, files, and refs from a remote repository into your local repo. Fetching is what you do when you want to see what everybody else has been working on.
The short answer is: you cannot pull a specific commit from a remote. However, you may fetch new data from the remote and then use git-checkout COMMIT_ID to view the code at the COMMIT_ID .
git log remotename/branchname
Will display the log of a given remote branch in that repository, but only the logs that you have "fetched" from their repository to your personal "copy" of the remote repository.
Remember that your clone of the repository will update its state of any remote branches only by doing git fetch
. You can't connect directly to the server to check the log there, what you do is download the state of the server with git fetch
and then locally see the log of the remote branches.
Perhaps another useful command could be:
git log HEAD..remote/branch
which will show you the commits that are in the remote branch, but not in your current branch (HEAD
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With