It's easy to track change per commit in Git using git diff
command. Do you know this command is more powerful than that? It allows us to see the difference between any two commits, and in a special case, between two versions.
To see what has changed from commit A to commit B, simply run:
$ git diff A B
The good thing is A
and B
can be anything that Git understands. They can be commit hashes, HEAD
or @
for the latest commit and tags.
It's worth to note that each tag should represent a version. So to compare the change between two versions (two tags), run this command:
$ git diff 1.6.17 1.6.18
And you'll get something similar to this:
diff --git a/class-mb-aio-loader.php b/class-mb-aio-loader.php
index 22d4e34..1a044d0 100644
--- a/class-mb-aio-loader.php
+++ b/class-mb-aio-loader.php
@@ -8,21 +8,19 @@
class MB_AIO_Loader {
public function __construct() {
- $this->load_premium_extensions();
+ // Use 'init' hook to make the filter 'mb_aio_extensions' can be used in themes or other plugins that loaded after this plugin.
+ // Priority 0 make sure it runs before any required hook required by premium extensions.
+ add_action( 'init', array( $this, 'load_premium_extensions' ), 0 );
$this->load_free_extensions();
}
Some other tips with git diff:
If you want to show the change in the last commit, simply run the command without any parameters:
$ git diff
If you want to show the change from 2 previous commits with the current code, run this command:
$ git diff @~2 @
(Note that @
means HEAD
)
You can also ssave the changes into a text file for reference later:
$ git diff 1.6.17 1.6.18 > changelog.txt
Leave a Reply