Section 3.4 Editing Local Files
In the last two sections you created a feature branch and switched to that branch. In this section you will edit your local files to fix the issue that you claimed in the issue tracker. Confirm you are on your feature branch now.
Exercises
2.
3.
Use a text editor to modify the file you identified in Exercise 3.4.2 so that the issue you claimed has been fixed.
Find the file in the Explorer pane to the left. This should show you the list of all the files and folders in the project. If you do not see the list of files and folders, click on the icon that looks like one sheet of paper on top of another.
Open the file in the editor and make the changes in the issue you claimed.
Your changes should be automatically saved.
Figure 3.4.1 illustrates the current situation where your Local Files have been modified. In Figure 3.3.1 the Local Files in your feature branch were drawn in green. This reflected that they were, at that time, an exact copy of the last commit on the main branch, which was also drawn in green. Here Local Files are drawn in blue to indicate that they have been changed as compared to the final commit in the main branch, which is still green.

4.
The
git status
command can now be used to check that your changes have been made. Run the git status
command now.If you see the message "nothing to commit, working tree clean", it means that your edits in the previous exercise were not saved. Go back and save your edits and then issue the
git status
command again before answering the questions below.(a)
Paste the output of the
git status
command below.(b)
- 0
- Perhaps you didn’t save your change. Try editing the file again and make sure you save it.
- 1
- Correct! The file you changed has been modified but not staged yet.
- 2
- Did you change more than 1 file by accident? Verify that you only changed the file specified in your issue.
- Cannot be determined from the output provided by the
git status
command. - The
git status
command will show you all unstaged and staged files.
How many files are not staged?
Hint.
Not staged means a file has been modified but not added to the commit.
(c)
- 0
- Correct! You have not added any files to the stage yet.
- 1
- Unless you already issued the
git stage
command you shouldn’t have any files ready to be committed. - 2
- Unless you already issued the
git add
command you shouldn’t have any files ready to be committed. - Cannot be determined from the output provided by the
git status
command. - The
git status
command will show you all unstaged and staged files.
How many files will be committed?
Hint.
If a file has been modified but not added it will not be part of the commit.
5.
- The new text is in red, the old text is in green.
- Look again to see what color your change appears in.
- The new text is in green, the old text is in red.
- Correct! The original text is in red, your changes are in green.
- Only the new text appears.
- Look again, you should see the original text as well.
- The old text appears with a strike-through line across it.
- Strike-through is not part of the feedback git commands can provide.
The
git diff
command provides another way to examine or confirm the changes you have been making. Note diff is just short for difference, and is called this because it is used to show differences. By default the git diff
command will show you any changes that have been made to your local files that have not yet been staged. Run the git diff
command now.How is the change that you made indicated in the output from
git diff
?Hint.
Look at the feedback again and look for your change. Do you also see the original text?
You have attempted 1 of 7 activities on this page.