Tuesday, July 10, 2012

Viewing History in Git

This tutorial will cover:
·  Introduction
·  Viewing Modes
·  Interpretation
·  What those changes mean to the users
·  Commands

About:
Git allows for programmers to share their code with other programmers to view and to edit.  Git tracks changes and allows the user to be able to view the individual stages of the changes that were made to the program. Different versions of a program correspond to different changes that were made. For more information about Git basics click here.

Viewing:
            ‘git log’
The command ‘git log’ will show you the commit history of the program in reverse chronological order.  It will include the following of each commit: checksum (unique file name), author’s email & name, date, and any comments. For example:



‘-graph’
This restructures the viewing history to show how the program has developed.

$ git log --pretty=format:"%h %s" --graph
* 2d3acf9 ignore errors from SIGCHLD on trap
*  5e3ee11 Merge branch 'master' of git://github.com/dustin/grit
|\
| * 420eac9 Added a method for getting the current branch.
* | 30e367c timeout code and tests
* | 5a09431 add timeout protection to grit
* | e1193f8 support for heads with slashes in them
|/
* d6016bc require time for xmlschema
*  11d191e Merge branch 'defunkt' into local

            ‘gitk’
The gitk is another type of history viewer but allows you to see the information in a more visually pleasing manner.  
                        





Interpretation

            Briefly mentioned above, the output from the viewing history will tell you several things. 
1)   The SHA-1 hash – a generated file name comprised of 40 characters using only the hexadecimal characters (0-9 & a-f). See also checksum.
2)   Human info – Name and email address of the committer
3)   Date – Date and time modified.
4)   Comments – Statements summarizing the changes made to the program during that modification.



What this means:
            This section is still in development.

Commands:

            ‘git log’ – brings up the commit history of your program
            ‘-p’ – shows the patches with each commit
            ‘-stat’ – statistics of the changes made (ex. number of lines added, etc. )
            ‘git log’ – allows you to narrow down the commits
                        ‘-<n>’ – shows last n commits only, where n is an integer
                        ‘--since’ - shows only commits since date specified
                        ‘--author” – narrows down by author




For more information visit these lovely websites:

No comments:

Post a Comment