FAQ: Basic Git Workflow - git diff

Community%20FAQs%20on%20Codecademy%20Exercises

This community-built FAQ covers the “git diff” exercise from the lesson “Basic Git Workflow”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development
Computer Science

Learn Git

FAQs on the exercise git diff

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

In exercise 6 it says " Notice the output:

  • “Harry Programmer and the Sorcerer’s Code: Scene 1” is in the staging area, as indicated in white." But its actually in green and red. Why?

“Harry Programmer and the Sorcerer’s Code: Scene 1” is already in the staging area that’s why it’s indicated in white. If you have done any changes to that line, it will be marked in red or green.

In the exercise, the last step says to “Add the changes to the staging area in Git. Recall that you will need to identify the file by its name.” What does that mean?

1 Like

You just have to use the name of the file that you are adding to the staging area. Your last line here should be:

$ git add scene-1.txt

because “scene-1.txt” is the file that you’re using and adding. If you didn’t identify the file by name, Git wouldn’t know what you want to add to the staging area.

i tried the "git diff"command on my computer so i installed MuffinPy<it’s a code editor btw
but it didn’t work.why?

2 Likes

Hello, I’m curious about these lines of codes, what do they mean?

  • index 913b994…2d6e91a 100644
  • — a/scene-1.txt
  • +++ b/scene-1.txt
  • @@ -1 +1,2 @@

3 Likes

Hello everyone,

I got through all the lessons in Basic Git Workflow once but stuck in the Manhattan Zoo. When I use “git commit”, it appeared like this. I don’t know how to get through this step (step 6)

When I ran “git commit”, the screen appeared this question. I chose Y and then the previous picture appeared

Git commit 2

I’m curious about this too, if anyone can explain.

Why does it ask you to add the scene to git again at the end? It told you to add the scene to the staging area earlier… is the last line of code needed?

I initially had that problem. You have to run it in the bash file

In exercise 6 it says " From the terminal, use the new command to check the difference between the working directory and the staging area.

Notice the output:

  • “Harry Programmer and the Sorcerer’s Code: Scene 1” is in the staging area, as indicated in white.
  • Changes to the file are marked with a + and are indicated in green."

The answer is on the terminal bash type “git diff scene-1.txt” then click enter you will then see the changes to the file.

1 Like

I was thinking the same thing; I’m curious as well!
Although, 5 yrs later…I suppose this isn’t going to be answered.