git log's Examples

This command is used to check the commit history. By default, if no argument passed, Git log shows the most recent commits first. We can limit the number of log entries displayed by passing a number as an option, such as -3 to show only the last three entries. | Ex :- git log -3

git log

This command lists version history for a file, including the renaming of files also.

git log –follow[file]

Lists version history for the current branch

$ git log

Lists version history in one line for the current branch

$ git log --oneline

Lists version history in one line, decorated in graphical form for the current branch

$ git log –oneline –decorate --graph

How to find and restore a deleted file in a Git repository

Use git log --diff-filter=D --summary to get all the commits which have deleted files and the files deleted;

git log --diff-filter=D --summary

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us