Skip to content

Suggestion for the clarification of git diff command in the Tracking Changes lesson #769

Open
@ebrahimifard

Description

@ebrahimifard

In the Tracking Changes episode of the Version Control with Git lesson, git diff command has been used in two different forms of without any switch and with --staged switch. The one without switch is introduced as "the differences between the current state of the file and the most recently saved version" and the other one is explained as "the difference between the last committed change and what’s in the staging area.".

Although they may seem fine, they are not accurate (especially the explanation of git diff). What this command in general does is to give us a report of the difference between various states of our files. Those states could be working directory, staging area, and commit. Thus, to make the above mentioned commands more precise, I suggest to change their definitions to the followings:

  • git diff: difference between the working directory and the last commit

  • git diff --staged: difference between the staging area and the last commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions