Skip to main content

GitKit (2nd ed.): Learn git and GitHub in Context

Section 3.1 Exploring Your Local Repository

Like in the previous chapter, you will be working within the development environment for this exercise.
Current State:
Figure 3.1.1 shows where you should be based upon the exercises in the previous chapter. You will have forked the upstream FarmData2 repository into your own GitHub account. You will then have cloned your fork into a local repository in the development environment. Your local files at this point are a copy that reflects the current state of the upstream main branch.
Let’s explore this state just a little before making the changes that address the issue that you have claimed.
Cloud image of fork, clone, and local files.
Figure 3.1.1. Fork, Clone and Local Files.

Subsection 3.1.1 Restarting the Development Environment

Exercises

1.
Click here to open your development environment
 1 
codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1
. Please be patient as this can take a few minutes. When the development environment is ready you will see the message "Kit development environment is ready for use." and your browser window will look similar to the following:
The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message.

Subsection 3.1.2 git log

The git log command provides a way to see information about the history of the project. It will display information about the most recent commits that have been made to the repository. By default, git log displays information about the 10 most recent commits. You can append a -2 (or -5) to show only the most recent 2 (or 5) commits.

Exercises

1.
(a)
    Which of the following commands will provide the four most recent commits?
  • git log
  • This will provide information about the 10 most recent commits, not just the first four.
  • git log 4
  • This is not the proper format, a symbol is missing before the 4.
  • git log -4
  • Correct!
  • git log +4
  • The symbol before the 4 is incorrect.
Hint.
Refer back to the beginning of this subsection for specifics about the git log command.
(b)
Ensure that you are in the directory containing your cloned GitKit FarmData2 repository (use the cd command if necessary). Then use the git log command from Task 3.1.2.1.a to display the information about the 4 most recent commits. (If you don’t see all four recent commits, press "return" or "spacebar" to see more; when you are done, press "q" to quit.)
A line that begins with "commit" appears at the start of the information about each commit. That line also contains a long string of numbers and letters. That string is called the SHA (secure hashing algorithm) hash. It is a string of digits (0-9) and letters (a-f) known as a hexadecimal number and it provides a unique identifier for the commit. Following the SHA hash is information about the author, the date the commit was made and the commit message that was used to describe the changes.
Paste the output of the git log command you typed in the space below.

Subsection 3.1.3 Reviewing the git log Output

Use the output from the Task 3.1.2.1.b to answer the following questions about the project history. Note, if you have started this exercise late, new commits may have been added.

Exercises

1.
(a)
    What is the SHA of the most recent commit by IrisSC?
  • f7330b62bf421c4a87830fee758105a790f6b6ba
  • That commit was not made by IrisSC.
  • d622e8d6d71e27890c73e2428e6dcf9d44ca606e
  • That commit was not made by IrisSC.
  • 80b4408aa0df6dadc4e5e2c310a5e5cbbc0b9d35
  • Correct!
  • 73feb3808ae8978deaddfeb9eb14ef6d99457d18
  • That commit was made by IrisSC, but it is not her most recent commit.
Hint.
Look at the dates of each commit. The SHA code appears above the author of the commit and date the commit was made.
(b)
    What is the date of the most recent commit to the repository?
  • Oct 11 2021
  • There is a more recent commit.
  • None of those listed.
  • Correct! The most recent commit is always shown first in the list.
  • Oct 8 2021
  • There is a more recent commit.
  • Oct 5, 2021
  • There is a more recent commit.
Hint.
To see the most recent commit you can scroll up in the terminal window or type the log command again.
(c)
    Who authored a commit on October 11, 2021?
  • Batese2001
  • Correct! Bates2001 authored a commit on October 11, 2021.
  • kit
  • kit did not author a commit on October 11, 2021.
  • IrisSC
  • IrisSC did not author a commit on October 11, 2021.
  • Grant Braught
  • Grant Braught did not author a commit on October 11, 2021.
Hint.
The author’s name will appear below the SHA and above the date of the commit.
(d)
    What is the purpose of the most recent commit by Elad Sheskin (username: shes-dev)?
  • Updated comment (#288)
  • Correct! shes-dev made this commit on October 5, 2021.
  • chore: install kit
  • This commit was not made by shes-dev.
  • Reorder Seeding Input (#281)
  • This commit was not made by shes-dev.
  • Summary Table Timing and No Log Messages (#289)
  • This commit was not made by shes-dev.
  • No Default Label For Drop Down Component (#293)
  • This commit was not made by shes-dev.
Hint.
This commit is older than the others, try a git log command that shows a few more commits.

Subsection 3.1.4 git status

The git status command provides the current status of your local repository. Use the git status command to see the current status of your local GitKit FarmData2 repository.

Exercises

1.
(a)
    What part of the output tells you which branch is currently active in your repository?
  • The branch name is displayed in the first line after "On branch".
  • Correct! The first line specifies the current branch.
  • The branch name is displayed at the end of the second line. It is "origin/main".
  • The second line specifies the origin branch not the active branch.
  • The branch name is not displayed in the output from this git command.
  • Look again, the active branch is listed.
  • The branch name is displayed at the end of the last line. It is "working tree".
  • The last line indicates if there are changes to commit.
Hint.
Look at the first line of the output from the git status command.
(b)
    Your output should contain the text “Your branch is up to date with ’origin/main’.” What do you think it means that your branch is “up to date”?
  • It means that your branch contains all of the commits in the origin main branch.
  • Correct!
  • It means that the origin main branch contains all of the commits in your local branch.
  • Think about what is being compared in that statement.
  • It means that your branch contains all of the issues in the origin main branch.
  • Issues are not part of a branch.
  • It means that the origin main branch contains all of the issues in your branch.
  • Issues are not part of a branch.
Hint.
Think about what could be "out of date". What differences might there be between the origin main and your branch?
(c)
    Your output should contain the text “nothing to commit, working tree clean.” What do you think it means that you have “nothing to commit.”
  • It means that you haven’t made any changes.
  • Correct!
  • It means that you haven’t created any issues.
  • Issues aren’t part of a branch.
  • It means you haven’t made any branches.
  • Branches aren’t committed.
  • It means the origin main branch doesn’t have any changes.
  • This statement is referring to your local branch, not origin main.
Hint.
When would you have something to commit? This is the opposite of that!
In the next section you will create a feature branch.
You have attempted 1 of 10 activities on this page.