Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use git log --graph --oneline --all only on my local branches?

Tags:

git

I would like to see all my local branches, but none of the remote tracking refs like origin/master

This command shows me a nice graph decorated with all my local and remote tracking branches:

git log --oneline --graph --decorate --all 

What flag should I add/eliminate in this command to show only local branches?

like image 626
0x90 Avatar asked Aug 29 '12 12:08

0x90


People also ask

Does git log show all branches?

Graph all git branchesDevelopers can see all branches in the graph with the –all switch. Also, in most situations, the –decorate switch will provide all the supplemental information in a formatted and nicely color-coded way.

What does the command git log -- Oneline graph do?

git log by default shows the entire ancestry in order by birthdate (where timestamp weirdities don't make that contradict ancestry). Try it with git log --oneline --graph --decorate --first-parent . ^ or ^1 means the first parent.

How do I limit a git log?

The most basic filtering option for git log is to limit the number of commits that are displayed. When you're only interested in the last few commits, this saves you the trouble of viewing all the commits in a page. You can limit git log 's output by including the - option.


2 Answers

This will show you all local branches.

git log --graph --oneline --branches 

From git log --help

--branches[=<pattern>]     Pretend as if all the refs in refs/heads are listed on the command line as <commit>.     If <pattern> is given, limit branches to ones matching given shell glob.     If pattern lacks ?, *, or [, /* at the end is implied. 

So --branches is enough. I like to add --decorate and give the whole command a short alias.

like image 112
Craig P. Motlin Avatar answered Sep 19 '22 08:09

Craig P. Motlin


Ain't sure what you need but how about something like:

git log --graph --oneline --branches --not --remotes=*

Note that it may filter out the whole log (e.g. in the case when you have an up-to-date branch so there is nothing you have only locally). Please consult git help log for the details.

If you need only the names and the last commit you can simply use:

git branch -v

Probably you can mix these to fit your needs.

But my preferred choice is gitk --all, here's an example output:

enter image description here

like image 33
rlegendi Avatar answered Sep 22 '22 08:09

rlegendi