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?
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.
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.
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.
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.
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:
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