Diff commit id with its first parent commit id
Here are some approaches to view diff between first parent of commit id and commit id. We’ll use 6680c1b29ea79bf33ac6bd31578755c7c514ed3e as commit for the purpose of this article.
-
Using git diff
$ git diff 6680c1b29ea79bf33ac6bd31578755c7c514ed3e^ 6680c1b29ea79bf33ac6bd31578755c7c514ed3e //or $ git diff 6680c1b29ea79bf33ac6bd31578755c7c514ed3e^!
-
Using git diff-tree
$ git diff-tree -p 6680c1b29ea79bf33ac6bd31578755c7c514ed3e
-
Using git show
$ git show --color --pretty=format:%b 6680c1b29ea79bf33ac6bd31578755c7c514ed3e
Diff a commit id with repository head
$ git diff 6680c1b29ea79bf33ac6bd31578755c7c514ed3e
Diff of head commit
$ git diff HEAD^ HEAD
Example showing diff of a commit id
Follow these steps to see the diff of a commit id.
-
Clone any git repository. We’ll clone jquery repository.
$ git clone https://github.com/jquery/jquery $ cd jquery
-
Run
git log
to view some recent commit ids. Run the following command for view diff for a commit id (6680c1b29ea79bf33ac6bd31578755c7c514ed3e).$ git diff 6680c1b29ea79bf33ac6bd31578755c7c514ed3e^ 6680c1b29ea79bf33ac6bd31578755c7c514ed3e
Here is initial portion of the outcome.
diff --git a/src/attributes/attr.js b/src/attributes/attr.js index ae48676..00b0848 100644 --- a/src/attributes/attr.js +++ b/src/attributes/attr.js @@ -7,7 +7,14 @@ define( [ ], function( jQuery, access, support, rnotwhite ) { var boolHook, - attrHandle = jQuery.expr.attrHandle; + attrHandle = jQuery.expr.attrHandle,