Git diff: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:


=Overview=
=Overview=
=Changes in the Working Directory that are Not Staged=
<syntaxhighlight lang='bash'>
git diff
</syntaxhighlight>
=Changes Staged for Next Commit=
This shows the difference between the index and the last commit.
<syntaxhighlight lang='bash'>
git diff --cached|--staged
</syntaxhighlight>
=Changes in Working Directory since Last Commit=
<syntaxhighlight lang='bash'>
git diff HEAD
</syntaxhighlight>


=Differences between Two Branches=
=Differences between Two Branches=
Line 10: Line 27:
</syntaxhighlight>
</syntaxhighlight>


<font color=darkgray>It seems the order in which the branches are specified does not matter.</font>
<font color=darkkhaki>It seems the order in which the branches are specified does not matter.</font>


For the entire repository:
For the entire repository:
Line 16: Line 33:
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
git diff develop..task/my-branch .
git diff develop..task/my-branch .
</syntaxhighlight>
=Compact Summary=
<syntaxhighlight lang='bash'>
git diff of/1296 --compact-summary
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 21:43, 16 January 2024

Internal

Overview

Changes in the Working Directory that are Not Staged

git diff

Changes Staged for Next Commit

This shows the difference between the index and the last commit.

git diff --cached|--staged

Changes in Working Directory since Last Commit

git diff HEAD

Differences between Two Branches

git diff develop..task/my-branch path/to/folder

It seems the order in which the branches are specified does not matter.

For the entire repository:

git diff develop..task/my-branch .

Compact Summary

git diff of/1296 --compact-summary