Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

Git /

Log

Git's log function is a very powerful tool, much more than its obvious, already useful standard use would make you think.

The first use is simply:

git log

which will allow you to navigate all the commits until the current one on the current branch. This is a great way to see what has been done (provided you have useful commit messages) and to navigate in the history of your repository using checkout.

Useful options

--name-only
View a list of the files that have changed for each commit.

Viewing a file's history using git log

More than just showing a log of what has been done in your repository, the log can also show you the entire history of a file. In order to do that, you need:

--follow
Follow the file across renames
-p
Produce a Patch (which is what gives all the diffs)
-- path
The path to the file of interest (Note: The -- is there to separate the options preceding it from the path information, rather than part of the path definition)

Together, they would be written as:

git log --follow -p -- path

Edit - History - Print - Recent Changes - Search
Page last modified on January 18, 2018, at 04:41 PM