-1

I have a repo called my_app and it's cloned and in the "developer" branch. Now I'd like to be able to view commit logs of this "my_app" repo, but another branch called prod/F2020.final.app.

According to what I've read here and here it can't be done without having to pull the destination branch.

My question is, is this the only way? Can't I just somehow clone some skeleton of just the logs part of the destination branch?

Mihai Chelaru
  • 7,614
  • 14
  • 45
  • 51
user63898
  • 29,839
  • 85
  • 272
  • 514
  • More specifically, you'd have to `fetch` from the remote repo, yes, but not `pull` in a local branch if you don't want to. `git fetch` then `git log origin/` (I'm assuming `origin` here for your remote since you talked about cloning, but if you happen to have changed it... yada yada) – Romain Valeri May 26 '20 at 13:27
  • @jo_ "*I know it can't be done **without having to fetch** the destination branch*" – phd May 26 '20 at 13:47

2 Answers2

0

Can't I just somehow clone some skeleton of just the logs part of the destination branch?

That’s a misconception of what a log is. A log is not some prerecorded words about the repo. (That’s a reflog.) When you say git log, git describes the repo, itself, right now. So no, you cannot say git log without actually having the commits you want logged.

In some cases you can ask the remote git (such as github or gitlab) to do a git log or reflog on its repo and tell you what it sees. It sounds like that’s what you’re after.

But you should first think about why you need that. If you cloned this repo, you already have the entire history. If prod/F2020.final.app was present at the time you cloned, you can log it now, without downloading anything else.

matt
  • 515,959
  • 87
  • 875
  • 1,141
-1

If the repo is hosted on gitlab or equivalent you can check this on gitlab-ui.

if you want do do this on local host then

// first step may not be becessary if branch you want to examine is on origin
// 1st add the remote to your remote list  
git remote add <remote-name> git@gitlab.<company>.com:<project>/<component.git>

// update repo's info  
git fetch <remote-name>

// log  
git log <remote-name>/<branch-name>

We used "git fetch" to retreive info (all info not just logs) NOT pull

You could also use gitk or some graphical interface to see the commits information

or if you are a cli fan

git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit  -10 <remote-name>/<branch-name>
jo_
  • 8,324
  • 1
  • 18
  • 14
  • `git fetch` is almost `git pull` — in addition to `git fetch` what `git pull` does is merge or rebase. So `git fetch` is what the OP wants to avoid. `git fetch` retrieves all objects — commits and blobs — while the OP only wants the list of commits without blobs. – phd May 26 '20 at 13:46
  • It's not a helpful answer. It doesn't answer the question on how to fetch commits without blobs. It doesn't say there is no other way. – phd May 26 '20 at 17:33