You might be wondering: "How do I make changes to this repo?" - and the short answer is: "You don't!". However, let's look at a pattern you can use to effectively follow along with the course!
You'll need to make sure a few things are completed before doing this:
- You have set-up your SSH key on GitHub.com. More details can be found here
- If you're on Windows, you'll need to make sure your WSL2 is set-up. More details on that can be found here
We're going to create a brand new repository on GitHub.com!
You can follow the guide here to do that!
Here's an example of the settings you should use:
NOTE: You can use any name - but the process will be easiest if you make sure
Add a README file
is deselected.
Once you've created your new repository. You'll need to capture its SSH
address.
You'll want to copy this address:
NOTE: Your address will be different - you can safely click the 'Copy' icon at the end of the address bar shown above.
Now you can execute the command:
git clone PASTE_YOUR_ADDRESS_HERE
Then we need to change-directory (cd
) into our newly cloned repository!
cd YOUR_REPOSITORY_NAME_HERE
NOTE: If you see a warning message like this:
warning: You appear to have cloned an empty repository.
- that means you've successfully followed all the steps so far correctly!
Now we're going to add the class repository as an "upstream remote".
First, we'll run this command:
git remote add upstream [email protected]:AI-Maker-Space/AI-Engineering-Cohort-2.git
We can verify we were successful by using the command:
git remote -v
You should see an output very similar to this (your origin will be a different address)
origin [email protected]:chris-alexiuk/AIE2.git (fetch)
origin [email protected]:chris-alexiuk/AIE2.git (push)
upstream [email protected]:AI-Maker-Space/AI-Engineering-Cohort-2.git (fetch)
upstream [email protected]:AI-Maker-Space/AI-Engineering-Cohort-2.git (push)
Now, let's look at a diagram of how this works:
As you can see - there are ~4 steps when working with this pattern.
- We first
git pull upstream main
the changes that were made to the AIMS repository - the one we just added calledupstream
. - Then we make changes to that code - and eventually we
git add .
it to ourgit
history. - Then we commit those changes (with a helpful message) to our
git log
. - Then we
git push origin main
those changes to our downstream repisitory - which is calledorigin
.
This pattern will allow you to create a public or private repository of your choosing, but still work from our repository!
But before we get to doing this - we'll first need to do our "first pull and push"!
This is a long command, but it basically just lets us "sync up" our git log
between the two different remote repositories.
It's easy enough in practice, we first need to git pull
the content from the AIE1 remote repository hosted on GitHub.com to our local repository.
git pull upstream main --allow-unrelated-histories
Then, we need to git push
the new content to our empty remote repostory on GitHub.com.
Now you're done!!!! 🎉