🥳 Are you coming here for the first time?
Welcome! Follow the Exercises below!
👋 Are you returning here to add or change something in your roster?
Head on down to Returners for tips on how to make this smooth for you and us!
- Hit 'Fork' on this repo (it's in the top right!)
- Make sure you are now looking at your fork (it will say
<your-github-username>/lfa-hello-github
at the top of the page) - Click the green 'Code' button and copy the SSH option if you have already setup git in your terminal, or the HTTPS option if not.
- Clone down your fork using
git clone <what you copied>
in your terminal - Move into the project folder with
cd lfa-hello-github
Okay, bad pun but it's true! Throughout the course we will be asking you to contribute to this repo again, so we want to make sure you can always get the latest version to work on
- Add us as a remote with
git remote add upstream https://github.com/LaFosseAcademy/lfa-hello-github.git
- Check that all is well so far by running
git remote -v
- You should see something similar to the following:
origin https://github.com/<your-github-username>/lfa-hello-github.git (fetch)
origin https://github.com/<your-github-username>/lfa-hello-github.git (push)
upstream https://github.com/LaFosseAcademy/lfa-hello-github.git (fetch)
upstream https://github.com/LaFosseAcademy/lfa-hello-github.git (push)
git pull upstream main
- Open it up in a text editor (if you have setup VS Code, you can do this from the command line using
code .
) - Make a change! In the
students
array, add a new JSON object with a key of "name" and string value of your name and another key of "github" and string value of your GitHub username to<your-cohort>/roster.json
and save the file (Windows/Linux: ctrl+s / MacOS: command+s). See example below and in other cohorts' rosters. - Check the git status of the project with
git status
-<your-cohort>/roster.json
should show in red as there are unstaged changes
{
"name": "Loki Laufeyson",
"github": "VariantL1130"
}
- Stage your change with
git add .
(orgit add <your-cohort>/roster.json
) - Check the status again -
<your-cohort>/roster.json
should now show in green as the changes have been staged but not yet committed
- Commit your change with
git commit -m "add <your-name>"
. The-m
is a flag for 'message' and you must leave a message with every commit!
- Check your
git status
again - there should be nothing to commit now but an indicator that your local version is one commit ahead of the origin - As it suggests, use
git push
to push up your work to GitHub!
- You made your own fork of this, in the web browser go to your repo
https://github.com/<your-github-username>/lfa-hello-github
to see if you can make a Pull Request back toLaFosseAcademy/lfa-hello-github
. Try and request review from @rom-30 or @moniafavaro. We will merge your PR when we receive it!
- Locate your local repo for this project (clone down your fork again if you deleted it before for any reason) and
cd
into the folder - Run
git remote -v
and make sure your output is similar to that in Step 2 above - Run
git pull upstream main
to get the latest updates from our central version of the repo
- You know how to do this now! If you'd like a recap, check out steps 3, 4, 5, 6 and 7 above.