Git tutorial #9 - More about Git log

in #tutorials8 years ago

Hello everybody!

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

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 ...

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 ...

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.

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...

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. 🙌

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 ✌️✌️

This is all for this post.

Regards!🤗 🤓

Sort:  

Great..what is the diff between 'git reflog' and 'git log' . I use source tree a lot now and some of the git commands seem redundant.

Hi codero, i think that git log return useful information but only a record of the commits that had occurred up until the point of when this particular hash was checked out. But git reflog it basically tells you the history of every action within git where data is stored and in this case, the history of branch switches and pulls/merges, etc

Este Post ha recibido un Upvote desde la cuenta del King: @dineroconopcion, El cual es un Grupo de Soporte mantenido por 5 personas mas que quieren ayudarte a llegar hacer un Top Autor En Steemit sin tener que invertir en Steem Power. Te Gustaria Ser Parte De Este Projecto?

This Post has been Upvote from the King's Account: @dineroconopcion, It's a Support Group by 5 other people that want to help you be a Top Steemit Author without having to invest into Steem Power. Would You Like To Be Part of this Project?

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by juanpchica from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.