0

I am working on an assignment, I need to generate the graph of my git repository like this with arrows

enter image description here

Is there any utility to generate graph like this? I know about gitg, gitk; But I need a utility through with I can generate a graph in the same format as the one shown in the picture?

Max
  • 9,100
  • 25
  • 72
  • 109
  • Do you want to see a picture going horizontally from left to right, or is `git log --graph --oneline --decorate --all` alright with you? – Makoto Sep 21 '15 at 06:35
  • 2
    If this is an assignment, won't the person assigning it to you want you to do it yourself instead of just finding a library that does it for you? – Patrick Stephen Sep 21 '15 at 06:35
  • `gitk`, using the `--all` parameter? It's vertical, but almost the same you are looking for. – skypjack Sep 21 '15 at 06:46
  • Looks a little like generated with dot. Tools unfortunately I don't know doing this. But looking forward to some too ;) – frlan Sep 21 '15 at 11:55

1 Answers1

2

An answer from inside SE could help here. It links to an alias, which is creating a dot file based on your git repository

Pretty much add:

[alias]
        graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format:  %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"

to your .git/config. After this, you can run it and create your diagram e.g. with

git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin

(also token from the link wiki resource). If you just redirect output to a dot-file, you can manually compile the graph on your wishes with dot or maybe neato. Also you can adjust the alias a little for better formatting (color, shape...) of e.g. nodes.

Community
  • 1
  • 1
frlan
  • 6,950
  • 3
  • 31
  • 72