How do i see the history of changes to a git repository?



  • git log man page: http://bit.ly/2pSxyFf

    A git repository is normally updated by many people working on a project. To see the history of changes over time, you can use the git log command, the output is paged through the less pager. The commit hash, who perform the action, the date, and the commit message. This is why accurately defined commit message titles are important, that is a big topic on its own.

    $ git log
    commit 289adb55844ac58469aec0d11fda5ee735812ead
    Author: Trainer1 <[email protected]>
    Date:   Sun Apr 23 09:04:01 2017 +0100
    
        renamed lastorders.php to lastdrinks.php
    
    commit cab9004b462f400ccdceb239d37710b62aaa6733
    Author: Trainer1 <[email protected]>
    Date:   Sun Apr 23 09:02:41 2017 +0100
    
        added lastorders.php from repo
    
    commit 184b98ae30d48a3254b5055a6fb7ac52af113239
    Author: Trainer1 <[email protected]>
    Date:   Sun Apr 23 09:02:18 2017 +0100
    
        removed lastorders.php from repo
    ...
    ...
    ...
    

    See the last two commits, showing differences/changes.

    $ git log -p -2
    commit 289adb55844ac58469aec0d11fda5ee735812ead
    Author: Trainer1 <[email protected]>
    Date:   Sun Apr 23 09:04:01 2017 +0100
    
        renamed lastorders.php to lastdrinks.php
    
    diff --git a/lastdrinks.php b/lastdrinks.php
    new file mode 100644
    index 0000000..7331fe4
    --- /dev/null
    +++ b/lastdrinks.php
    @@ -0,0 +1 @@
    +Last orders please!
    diff --git a/lastorders.php b/lastorders.php
    deleted file mode 100644
    index 7331fe4..0000000
    --- a/lastorders.php
    +++ /dev/null
    @@ -1 +0,0 @@
    -Last orders please!
    
    commit cab9004b462f400ccdceb239d37710b62aaa6733
    Author: Trainer1 <[email protected]>
    Date:   Sun Apr 23 09:02:41 2017 +0100
    
        added lastorders.php from repo
    
    diff --git a/lastorders.php b/lastorders.php
    new file mode 100644
    index 0000000..7331fe4
    --- /dev/null
    +++ b/lastorders.php
    @@ -0,0 +1 @@
    +Last orders please!
    

    To see oneline (title) history of commits. There are various options to --pretty, see the man page.

    $ git log --pretty=oneline
    289adb55844ac58469aec0d11fda5ee735812ead renamed lastorders.php to lastdrinks.php
    cab9004b462f400ccdceb239d37710b62aaa6733 added lastorders.php from repo
    184b98ae30d48a3254b5055a6fb7ac52af113239 removed lastorders.php from repo
    

Log in to reply
 

© Lightnetics 2024