How to check Git Logs?

Configurare noua (How To)

Situatie

Solutie

Pasi de urmat

Prettier log:

To see the logs in a very decorated, neat, and clean manner we use the following command.

git log --decorate --oneline --graph

Since it’s a pretty big command we can assign an alias to this command

git config --global alias.name_of_alias "command_name"

So now let’s break this command into parts git config –global this is used so that the alias would be globally recognized as a command in git alias.name_of_alias is used to give alias a name and then the “command_name” is the command of which you are making an alias and this command should be written in double-quotes. Now to use the alias of the command type in git alias_name  and if you want to see the history of everything in your repository pass in –all as a parameter in the command.

Colorize logs:

To see the logs in a colorized fashion or to customize the  log output format we use the below command:

git log --graph ---pretty=format: '%C(red)%h%Creset  -%C(yellow)%d%Creset %s %C(green)(%cr)%C(yellow)<%an>%Creset'

We can also make an alias of this command in order to avoid writing this big command. The command used for creating the alias would be the same as we used in creating an alias for displaying the log output format in a decorated manner. The command used is:

git config --global alias.alias_name "Command_name"

Oneline log:

This will display the log outputs in oneline. But it only shows first some parts of the commit id and the commit message.

Tip solutie

Permanent

Voteaza

(5 din 8 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?