Let's get to know each other better! We'll play an icebreaker called Two Truths and a Lie, but instead of chatting in person, we're going to use git and GitHub to chat about what the lie is. Read the instructions very carefully as you work through this exercise and let a teacher know if you need clarifications.
-
Clone this repo and navigate to it
More about cloning
In your browser find the clone URL in the sidebar and copy it. In your terminal, run the following command, replacing
CLONE_URL
with the URL you copied:cd ~/workspace git clone CLONE_URL cd two-truths-and-a-lie
-
Tell git who is driving, using
git iam
More about
git iam
This is how we credit commits under your name when you're working on an on-campus machine or (for online students) in VS Code LiveShare.
- Online students, please install and configure
git-iam
(following the instructions in theremote-git-iam
repo) - On the on-campus computers,
git-iam
is already set up for you - If you're working solo on your own machine, you will have configured git globally already, and you don't need
git-iam
git iam DRIVERS_GITHUB_NAME
- Online students, please install and configure
-
Create a new branch named for you and your partner
More about branching
To do this we use the
git branch
command.git branch
on its own lists out all local branches, but when we give it an argument it creates a new branch. A new branch is a copy of the current branch with a different name.In your terminal, run the following command, replacing
partner1
andpartner2
with your name and your partner's name in any order you decide:git branch partner1-partner2 # e.g. emily-kelly git checkout partner1-partner2
You could also do this in one step:
git checkout -b partner1-partner2
The result should be one new branch named after your pair.
-
Modify the file
two-truths.md
so that for each of you it contains your name, and three facts about you. One of these facts should be completely made upTip
- You should remove the entries for Neil Armstrong and Buzz Aldrin.
-
Stage and commit your file to the project
More about staging and committing
Use the following commands:
git add . git commit -m "Added truths and lies"
-
Push your branch to GitHub
More about pushing
git push origin YourName-PartnersName
-
Find a pair to bust
More about pairing
On-campus students: a teacher will guide you to find the cohort mates with whom you're going to play lie detector. Ask your teacher who you're busting!
Online students: Post in the
general
channel in Discord when your branch is ready to be busted. When you select another pair's branch to bust, mark their Discord message with an emoji reaction. -
Pull your cohort mates' branch from GitHub into your local repository
More about pulling
git fetch git checkout THEIR_BRANCH
-
Create a new branch for your changes
More about branching (again)
git checkout -b THEIR_BRANCH-busted
What is the difference between this command and the one in the previous step?
git --help checkout
-
Open
two-truths.md
and add the word LIE to the line you think is a lie -
Stage the changed file and commit it
More about staging and committing (again)
git add two-truths.md git commit -m "Found the lie"
-
Push this branch to GitHub
More about pushing (again)
git push origin THEIR_BRANCH-busted
-
Submit a pull request on GitHub of your changes. Be sure the pull request is from
THEIR_BRANCH-busted
intoTHEIR_BRANCH
Now it's time to come clean (or not).
-
Once someone has submitted a LIE pull request on your branch, comment on the pull request
More about reviewing
You might leave a comment such as...
- "Yep you got it" or
- "Nope but perhaps you really meant to choose #1" or (if you're devious)
- "Nope, keep guessing".
In any case, close the pull request and make sure the target branch is the correct one, not
main
.
More about stretch challenges
If you finish the main challenge with time left over, try these activities to solidify what you learned:
- Draw a diagram of the Git workflows you used in sections 0-5
- Describe the workflow using your picture and words (i.e. not code) to your pair or a teacher
- Make sure you understand all parts completely. You will be using this workfow extensively in the next nine weeks. Ask questions if anything is still unclear!