Git Task Instructions
gitTask_Instructions
User Manual:
Open the PDF directly: View PDF .
Page Count: 4
Name:
10MPRO Unit 3: Organisation and Resources
Git and GitHub Task
In this task you will examine an existing GitHub repository, answering questions about it and
making changes of your own. By following the step-by-step instructions you will learn how to
Fork, Clone, Commit, Push, and interpret a Git repository.
Step
Instructions
Marks
1.
First, make your own personal copy of the repository on GitHub.
Visit: https://github.com/NorthcoteHS/gitTask
Click “Fork” in the top-right corner. You may need to log in first.
1
2.
Next, create an empty folder to clone your fork into.
In Brackets, use the Project drop-down to “Open Folder…”
Create a new folder within 10MPRO called gitTask and click “Select
Folder”
1
3.
Now, clone your new personal copy to your local computer.
On your fork (in GitHub), click the green “Clone or download” button.
Click the “Copy to clipboard” button beside the URL.
In Brackets, open the Git extension (the Git button on the right)
In the “Git tray” at the bottom, click the “Clone” button
Enter the URL you just copied (Ctrl-V or Cmd-V to paste)
Hit OK (no need for Username/Password)
1
4.
Great! Now you’re set up with the repo.
To answer the next few questions, you’ll need to get familiar with the buttons
on the Git Tray. Take a look at them now.
1. Select all changed files
2. Commit selected changes
3. Show Git history
4. Show file history
5. Refresh Git panel
6. More actions (“Hamburger”)
7. Remote picker
8. Fetch
9. Pull
10. Push
11. Git Bash
12. Git Settings
Name:
5.
Press the Git History button for a full list of commits.
a. What is the message on the most recent commit?
b. What is the message on the very first commit?
c. What date was the first commit made? You can find out by hovering
over the date (“3 months ago”) – a tooltip will pop up with the
specific date in MM/DD/YYYY format.
d. Who was the author on both of these commits?
4
6.
You can get more information about any single commit by clicking on it in
the list. Find the commit with message “Add draft of UI” and click on it.
a. How many files were changed in this commit?
b. How many lines of text were added to the first file (sources.txt)?
These are indicated by green text with + at the start.
c. Why don’t the other files in this commit show text being added or
removed?
3
7.
Each commit has a unique identifier, called a “hash”. The first 7 characters of
each hash are shown on the right edge of the commit list. Find the commit
f5b85bb.
a. Who is the author of this commit?
b. What is the author’s email address?
c. What date was the commit made?
4
Name:
d. What are the last 5 digits of the full hash? This can be found by
clicking the “…” next to the hash in the commit summary.
8.
Another useful tool is the File History. Select createAccount.py in the file
tree on the left, then click on the File History button.
a. How many commits were made affecting this file?
b. Who improved the “yes/no” logic in the file?
2
9.
Use the commit history and/or file history to answer these questions:
a. Who was responsible for adding the photo assets?
b. When was Denny’s first commit?
c. What new app names were added to the list of name ideas on Feb. 5?
3
10.
Next we’re going to make some changes to the repo. Before doing anything,
we need to set up our username and password. Click the hamburger and:
a. Select “Change git username” and enter your full first and last name
(with capital letters and a space).
b. Select “Change git email” and enter the email address you use for
GitHub.
2
11.
Look again at the most recent commit.
a. What did it change?
b. This commit was a mistake, and we want to undo it. Click the
hamburger and choose “Undo last local (not pushed) commit”. What
happens in the Git tray?
5
Name:
c. We want to completely get rid of those changes, so click again and
select “Discard all changes since last commit”. Now what does the Git
tray say?
d. This commit still exists on our GitHub repository, which is why the
Pull icon has a number beside it now. We want to get rid of it
entirely on GitHub. Note: this next action is very dangerous, and
should only be done as a last resort and if everyone who uses the
repository knows it is happening.
Open the Git Bash and type: git push -f origin master
(the -f means “force”)
When done, close the Git Bash, and hit the Refresh icon. What
changes when you hit refresh?
e. Go back to your browser and examine your GitHub fork. Refresh the
page – what message does it say about your branch and
NorthcoteHS:master?
12.
toDo is missing a file extension. Add an appropriate file extension and
commit it with an appropriate message.
2
13.
Every GitHub project is made better by a readme that describes the project
to others. Add a file named README.md at the root level with the following
text, and commit with an appropriate message:
# Pet Dating App
Our app puts playdates in the paws of your pets!
## Authors
Jodie, Allen, Elyse, and Denny
2
14.
You’re all done! Push all of your commits to your GitHub fork using the
Push button. You will need to enter your GitHub credentials.
1
15.
Back on your GitHub page, find the “Pull request” button on the right (under
the green Clone button).
Click it, then hit the green “Create pull request”.
Enter your name in the “Title” field, then hit the second green “Create
pull request” button at the bottom.
This submits your fork’s changes back to the original repository for review!
1