Reviewing Git repositories
While working with Git repositories, you often want to review the changes you’ve made.
Viewing differences in files
You often want to know what you have changed but not yet staged and what you have staged but not yet committed. To find out, you can use the git diff
command, which shows the code statements added and removed, also known as the patch.
Let’s see an example:
- To make it easier to work with the solution and project, open the
Chapter03
solution file in Visual Studio or Rider, or open theChapter03
folder in Code. - In the
RepoDemo
project, using your preferred code editor, inProgram.cs
, change the message fromHello, World!
toHello, Git!
, as shown highlighted in the following code:Console.WriteLine("Hello,
Git
!"); - Save changes to the file.
- At the terminal or command prompt, show the differences, as shown in the following command:
git diff
- Note...