WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Git · Intermediate · question 22 of 100

How can you view the differences between the working directory and the most recent commit?

📕 Buy this interview preparation book: 100 Git questions & answers — PDF + EPUB for $5

In Git, you can view the differences between the working directory and the most recent commit using the git diff command. The git diff command compares the current state of the files in your working directory to the most recent commit and shows the differences between them.

Here’s an example of how to use the git diff command:

    # View the differences between the working directory and the most recent commit
    git diff

This command will show the differences between the files in your working directory and the most recent commit. Lines that have been added to the file will be shown in green, while lines that have been removed will be shown in red.

If you want to see the differences between a specific file in your working directory and the most recent commit, you can specify the file name as an argument to the git diff command:

    # View the differences between a specific file in the working directory and the most recent commit
    git diff <file-name>

This command will show the differences between the specified file in your working directory and the most recent commit.

In summary, you can view the differences between the working directory and the most recent commit using the git diff command. This command compares the current state of the files in your working directory to the most recent commit and shows the differences between them. By using the git diff command, you can easily see what changes have been made since the last commit, which can be helpful for reviewing changes before committing them or debugging issues in your code.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Git interview — then scores it.
📞 Practice Git — free 15 min
📕 Buy this interview preparation book: 100 Git questions & answers — PDF + EPUB for $5

All 100 Git questions · All topics