- [Instructor] Here's my GitLab repository.
And if you click on the Graph link there,
you can see that I actually get a nice little graph inside
of the GitLab UI here.
But I wanna see this type of a graph inside of the terminal.
And so the way to demonstrate the Git log graph command
is to first copy your repository URL.
You can get that from Bitbucket, GitLab, GitHub, whatever,
and open up a terminal,
and then just do a Git clone command.
So I'm gonna do a Git clone, provide that URL,
(keyboard clattering)
put some credentials in there and then Bob's your uncle.
You just got to move into that GitLab folder,
GitLab Made Easy is the name of the project
that I cloned and there it is.
Now, with the Git log command,
that just the normal Git log, just prints out all
of this information.
I'm not a big fan of that format.
I always liked to Git reflog commands output
because it's just one line.
And if you wanna do that with the Git log,
you can always just do Git log one line and I don't,
I think that's a bit easier to read,
but you know what would be even easier to read
is if we got a nice little graph in here,
so then we could see these different branches.
You see merge from develop, merge fun feature,
all of this other stuff in here.
Let's, get a graph in there.
And so the way to do that is just to Git log
double dash graph. (keyboard clattering)
And well, these lines over here are supposed
to be the graph, but you can see
that when you've got this crazy full output,
it's not too helpful.
I think a few carriage returns down.
You can kind of see the graph being displayed there.
They're supposed to represent, three different branches,
one, two, three, it looks like I've got master.
It looks like I've got, is it the Hotfix branch
or the release branch.
I've got a develop branch there may be even,
this one here looks like a feature branch
that here gets merged into develop,
which gets merged into master.
But you know what?
I still don't like this format.
So I press the Q button to get out of there.
I like so Git log, dash dash graph and then throw
in the one line command.
And now it looks a little bit more handsome
and readable, right?
So now you can kind of see,
oh yeah, there's my master branch and then boom,
it kind of branches off here into this feature branch
and then boom, the feature branch gets merged
into the develop branch and then boom,
it gets merged into master.
And while all this crazy stuff is going on,
we've got parallel development there the Hotfix.
The Hotfix branch branches off,
and then we get a commit here
and then the Hotfix goes back into master
and then finally everything is working well.
So, I like that.
That's kind of the way that I like to view the graph.
I like to not only have the graph there,
but do it on one line so that you can actually see
the graph without all the information from the log.
And by the way you can also there's other ways
to manage the log.
I've got a log format tutorial.
You can always say, Git log pretty and then say,
well you can say one line,
which just does kind of the same as the one line command,
except it gives the long hash.
You can say, hey, just give me some short information
about the commit.
You can even say, hey,
I want full information about the commit.
And there's a bunch of different options.
Hey, I wanna see the email address
of the person that puts in the email address too.
So there's all sorts of different options.
But the one that I'd like to use with the graph,
is the reason why I'm showing you this, is you can put
in a custom command.
So watch this, I'm gonna say, hey,
I want a custom command with the Git log
I do pretty and then I've got a custom string here.
I'm gonna run this command so you see what it looks like.
Then I'm gonna explain it,
so don't feel the need to pause right now.
I'm gonna paste that command back in here.
But you can see what I've done with this command.
So the results here are from running
this command previously.
I'm doing the log, I'm using the pretty command,
but I'm providing a custom string,
you can see that quote there,
beginning and end means it's a custom string.
And I've said, hey, I want the first output to be yellow.
And I want the word Hash colon to appear,
you see Hash colon there.
Percentage lowercase H is the short hash,
upper case H is the big hash.
Dash C changes the color to blue.
And I wanna say, hey, the date colon
is you can see that there and then put the actual date in.
So I specified a human readable date too rather than going
short date or something like that.
And then I changed the color to red, I have message colon.
You see that there, and then it's actually
the Git commit message.
So this is a cool way to pretty up your Git log.
I'll run that again.
And the reason I'm showing that to you now is because,
you can pretty up your Git log with a custom message
and there's, you can include the email of the user.
You can have the long hash, you can have the commit date.
You can have like references to other commits.
You can actually customize this, this log using pretty
at a number of different ways,
but you can also combine it with graph.
So there you go.
We've got the pretty approach to doing the log
along with the graph and hey, there you go.
It looks, it looks pretty good.
I think I got a bit of an overflow on that line there,
but hey, not a big deal.
And yeah that gives you an idea
how to not only use that graph command
but also use the pretty command,
the one line command, and then, hey, bring it all together.
Get a real handsome output of your Git Log Graph.