Skip to main content

Important Git commands to view logs

Here are some common and important Git commands for viewing logs:

git log

Show the commit history for the current branch.


Press Q to return

git log -n

Show the last n commits.

git log --oneline

Show the commit history in a single line format.

git log --decorate

Shows the commit history with reference labels such as branches and tags that point to specific commits.

git log --graph

Show the commit history in a graphical format.


Combination of different options:

git log --decorate --oneline --graph


Alias can be created for long query.

git config --global alias.logDetail "log --decorate --oneline --graph"

git logDetail 

git log -p or git log --patch

Show the commit history with changes made in each commit (Show changes lines).

git log -1 --stat

Show the commit history with statistics about changes (Show committed files) and 1 displays latest one commit only. 

git show <commit-id>

Shows detailed information about a specific commit, including the commit message, author, date, and changes made in the commit.


cat <file name>

“cat” is not a git command. It is a basic Unix/Linux command used to concatenate and display the contents of one or more files in the terminal.



These are basic options, and there are many more options and configurations available with the git log command.

I trust that this information has been useful for you. Appreciate you taking the time to read the blog.

Comments

Popular posts from this blog

WhatsApp Text Formatting!

WhatsApp rolls out text formatting options including bold , italic , strike-through and combinations of these in messages. It can be done as below. Bold using asterisk: *bold text* Italic using underscore: _italic text_ Strike-through  using tilde: ~strikethrough text~ Combination for bold and italic : *_bold italic_* Thank you!

How to run and read traceroute test in Windows, Networking!

Traceroute is a network utility program to trace the path from one network to another. It displays response times that occur at each stop (hops) along the route. We can know if there is any connectivity issue or latency connecting to a target. The stops having issue can be identified by looking into the report generated by traceroute. Command: tracert hostname hostname - Name of the destination server that is traced Example: Reading the traceoute test results: There are 6 rows. Each row represents a hop. Route can be traced up to maximum of 30 hops. There are 5 columns in each row. Hop# - No. of hops that packets are traveled RTT (Rount Trip Time) Columns - Time taken by packets to communicate with the host (both way). Three separate packets are sent. It helps to check consistency or a lack in the route. Domain/IP Address - IP address of the router. Domain name is displayed if it's available The data of RTT columns are important to check if there are fa