Learn
Good work! Now you know how to add a file to the staging area.
Imagine that we type another line in scene-1.txt. Since the file is tracked, we can check the differences between the working directory and the staging area with:
git diff filename
Here, filename
is the actual name of the file. If the name of my file was changes.txt the command would be
git diff changes.txt
Instructions
1.
In the code editor, add this text to scene-1.txt:
Dumblediff: I should've known you would be here, Professor McGonagit.
Click Run.
2.
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.
3.
Add the changes to the staging area in Git. Recall that you will need to identify the file by its name.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.