Thermatix
Thermatix

Reputation: 2929

How to graph git branches

I'm not sure if graphing is what I need but I think it is.

I have a rather large proliferation of git branches, I want to slim this down by deleting old branches, and merging branches that can be merged and so on, but looking at them I can't quite remember which is which.

Is there a way to graph the branches so I can for example, branches by date, or how branches differ and so on?

I'm sorry if I'm not being clear, It's a little hard to describe exactly what I'm after.

Upvotes: 1

Views: 389

Answers (1)

pratZ
pratZ

Reputation: 3356

You can sort your branches based on recency,

git for-each-ref --sort=-committerdate refs/heads/

Delete the branches which are old. I use it personally for the same purpose.

Or better and more readable,

git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/

To check all the unmerged branches in the current branch,

git branch --no-merged

For a graphical view of all the branches in terminal, you can use the git log's graph option,

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

Upvotes: 3

Related Questions