6

In my local repository, I add a new remote and fetch its history:

$ git remote add foo_remote git@github.com:joe/foo.git
$ git fetch foo_remote

Now, how to view the log of all branches of only this remote? I am interested in viewing the commits (using git log) and DAG of this remote only (using gitk).

I know that I can view the log and DAG of a particular branch on this remote:

$ git log foo_remote/branch1
$ gitk foo_remote/branch1

I want something that does this:

$ git log foo_remote/*
$ gitk foo_remote/*
Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292
  • @jthill Not a dup. The answers to the question is about a particular branch on a particular remote. What I want is all branches of a remote. – Ashwin Nanjappa Aug 17 '16 at 02:25
  • Yah, I'd already retracted my close vote, forgot about the comment. – jthill Aug 17 '16 at 02:26
  • See [jthill's answer](http://stackoverflow.com/a/38987179/1256452), and note that `--remotes` takes a glob style pattern and if you don't include any wildcard characters, Git adds `/*`. – torek Aug 17 '16 at 02:38

2 Answers2

8

gitk takes rev-list options, so you can e.g. gitk --remotes=origin

jthill
  • 55,082
  • 5
  • 77
  • 137
  • 3
    So does `git log`. :-) – torek Aug 17 '16 at 02:35
  • 1
    initially i thought this didn't work.. but the confusion turned out to be: when you filter for a specific remote, gitk will still show other remotes for commits that are *in the lineage* of the specified remote. – ChaseMoskal Oct 28 '21 at 18:24
  • @jthill YOU ARE MY HERO! This also works: gitk --remotes=origin/cd_* I'M SO HAPPY TO LEARN THIS! THANK YOU! – TruncatedCoDr Oct 06 '22 at 16:29
5

Viewing the commits for all the branches, you can use:

git log --all

Also, the gitk accepts the --all option, so you can do:

gitk log --all

You can also use this:

git log --graph --oneline --branches

Or

git log --graph --oneline --all

for remote branches as well.

Derick Alangi
  • 1,080
  • 1
  • 11
  • 31