Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude remotes from git log --graph

Tags:

git

I would like to show a simple graph of the relationships between all my git branches. So far the closest I have gotten is this command:

git log --graph --oneline --branches --decorate --simplify-by-decoration

However, the project I work on has a ton of remote branches used by other developers that I don't care about and their inclusion in the graph make it hard to see the connections between my branches. I have tried adding --not --remotes="*", but that eliminates so many commits that I completely loose the tree structure and just get a list like branch -v.

Any suggestions?

Edit: I would like to find the best solution possible using the standard command line tools, as I'm usually not working at my own computer, and can't depend on other third party software being installed.

like image 383
pavon Avatar asked May 08 '14 00:05

pavon


2 Answers

Here's a crude but effective method:

temp=`mktemp -u`
git clone -s --bare `git rev-parse --git-dir` $temp
git --git-dir=$temp log --graph --decorate --oneline --branches --simplify-by-decoration
rm -rf $temp

The -s option tells git to make a ridiculously lightweight clone, and git log doesn't need a worktree.

like image 196
jthill Avatar answered Nov 15 '22 05:11

jthill


How about using a gui git tool like gitg (linux) / gitx (OSX) where you can pick local branches only as in:

enter image description here

like image 38
Michael Durrant Avatar answered Nov 15 '22 05:11

Michael Durrant