In this section you will do the work necessary to commit the changes made to your Local Files to your local repository. The process of committing changes is illustrated in Figure 3.6.1.
Exercises
1.
As you saw earlier when looking at the output of git log, each commit has a commit message that briefly describes the changes that are contained in the commit. These messages should be concise but meaningful without requiring the reader to refer to the ticket in the issue tracker. A future reader of the git log output should be able to obtain an idea of the changes you have made and why you made them by reading your commit messages.
For each of the following issues, order the given commit messages from best (listed first) to worst (listed last).
(a)
Issue: The documentation says “bug” instead of “bugs” where plural is needed.
Pluralize bug (i.e. bugs) for clarity
---
Fix issue #123
---
Fix typo
(b)
Issue: The harvesting log should be able to track insect presence.
Add tracking for insects in harvesting logs
---
Insect tracking added
---
Extend harvest logs
2.
The git commit -m "<message>" command commits all of the staged files to the currently active branch with the specified commit message. Use the git commit command to commit your staged changes to your local repository with a meaningful commit message.
(a)
Provide the command you entered.
(b)
Now use the git status command again. Compare your output to the output in Task 3.5.1.c. What two changes have occurred that reflect that your changes have been staged?
No files appear listed as modified in red (meaning they are unstaged).
No files appear listed as modified in green (meaning they are staged).
The output states "nothing to commit".
All of the above.
(c)
How do you know your changes have been committed?
(d)
Use the git log command to show the 3 most recent commits to your branch. How is this output different from what you observed in Question #1? Briefly explain why? Note: Question #1 is now a multiple choice question. Maybe there should be multiple choice questions here that are similar (showing that the new commit appears in the log). I’m not sure I understand this - Question #1 is a parson’s question.
(e)
Switch to your main branch. What command did you use?
git status
git stage main
git branch main
git switch main
(f)
The output of the git log command now shows the information about the commit you made.