Git tutorial #9 - More about Git log

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
ยท@juanpchicaยท
0.000 HBD
Git tutorial #9 - More about Git log
<center>

Hello everybody!

In this post we will continue explaining a little more in depth the `git log` command.

https://git-scm.com/images/branching-illustration@2x.png

Well as we know this is the command we use to see the history of commits that has our project, this is very important because it gives us some data as the author of that commit or the date it was made, also a commit identifier .

But this command has some very important options that help us to filter a bit this list of commits, since for example when our project has good weather using git, we will have many commits and we need a way to filter or sort, and not return crazy with this amount of commits. ๐Ÿ˜ ๐Ÿ˜ 

As we already know when we execute the `$ git log` command we get this listing ...

![](https://steemitimages.com/DQmdb5QUgTqANAtoNbMcrFGXMsnnreoARHjt81B65cUp3rk/image.png)

## Log on a single line each commit

This is a very good option, since it allows us to show more quantity of commits and it facilitates much the view.

`git log --oneline`

When we run the command we have something like this ...

![](https://steemitimages.com/DQmd8JbTfFaQMd6ceCxDniUxQDBKB71vrKomjJf3SjLpghd/image.png)


## View commits for a given amount

This option is good if we want to show a number of commits given, for example if we want to show the last 5 commits we write the following command `git log -5` where the number is the number of commits to display.

![](https://steemitimages.com/DQmcV23wXkfMMdxhbg6ADgrF84mwxnzj8ZsLxeQG7pc8FYX/image.png)

## View extended commit information

This option is very good if we want to see all the complete information of the commit, because it also shows us specifically what changes were made to each file, with this command `git log -5 -p` we just add the` -p` and we will get it following...

![](https://steemitimages.com/DQmNpf9JrRiqi9S6CNuGPwBhg6NgoR3CkDDw2haeoUvj1Gj/image.png)

As you see, we get the code with a `+` sign indicating that those lines were added or `-` if some lines of code were removed. ๐Ÿค“ ๐Ÿ˜Ž

`git log --graph --oneline`

This command shows us the commit in a line and the branches in which you were, with its different operations. ๐Ÿ™Œ

![](https://steemitimages.com/DQmPUWaiJBsS9Q5h5X8vsihHzNW1kWMim4XLUNg3SWsyjny/image.png)

In this case we will not have much info to show, but when we create our project branches we will see better this command.

If you want more information about git log, in this [link](https://git-scm.com/docs/git-log) โœŒ๏ธโœŒ๏ธ 

This is all for this post.

Regards!๐Ÿค— ๐Ÿค“ 

</center>
๐Ÿ‘ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,