This repository will contain everyone's different joke websites from lesson 2. We will use it to learn Git and GitHub, and to work collaboratively!
Check out the live page with everyone's websites!
-
Use
git clone
to copy this repository down to your local machine.Code
git clone https://github.com/developer-delta/dev-delta-jokes.git
-
cd
into the newly cloned directory.Code
cd dev-delta-jokes
-
Use the
git checkout -b
command to create a new branch for the changes you will be making.Code
# the -b flag stands for "branch", as in you are creating a new branch with this name git checkout -b kylos-website-addition
You can name it whatever you like, but descriptive branch names are always good!
-
Create a directory (
mkdir
) in the base folder titledyour-name
.Code
# in the directory "dev-delta-jokes" mkdir kylo
-
Copy over your
html
andcss
files from your joke website CSS homework into your newly created directory.Code
cp location/of/your/joke/site/index.html kylo
cp location/of/your/joke/site/main.css kylo
- Next you'll need to make a change to the
index.html
file in the root of the repo.-
Find your name in the placeholder list items to edit inside the
ul
element. -
Inside your list item, add an anchor tag that links to your
html
file for your joke website.Code
<li><a href="kylo/index.html">Kylo's joke page</a></li>
-
-
After we are done making our changes, we need to
git add
our files, andgit commit
them to be all bundled up and ready to go to GitHub. we can pass directories togit add
to add everything insideCode
git add kylo/
git add index.html
# -m stands for "message", so "commit these changes with this message" git commit -m "my first commit"
-
Now that you have committed (saved) your changes locally on your own branch of this repo, you need to push that branch up to GitHub using
git push
!Code
git push
Hmm... that probably didn't work for you either, huh? The reason is that you created that branch only on your local machine! GitHub has no idea that it exists, so we need to tell it about it and then we can push it up! We even got some helpful output from Git telling us what to do!
git push --set-upstream origin kylos-website-addition
In that command, "upstream" means on GitHub/the internet, and "origin" is saying this is the name of the GitHub home for my new branch
- Alright!! Now we just need to create a pull request to say "hey I want to merge my code (on my branch) back into the big main repository (master branch) so I can see my changes on the internet!"
-
This part we will do in GitHub itself. So open up the
dev-delta-jokes
repository on GitHub. -
If you click on the button that says
master
, that's for "master" branch, you should see your branch listed underneath there! Go ahead and click on it. -
Now we are viewing our branch in the UI of GitHub. To the right a little bit is a
Pull request
button we can go ahead and click on now. -
Now you should see a page noting that there are differences between the
master
branch and your branch. This is expected because we made some changes to add our website and the link to it to this repository. So now go ahead and clickCreate pull request
! -
What happens next is your Pull request will be reviewed by whoever is the maintainer of the repository, and they may make comments on your pull request, or approve and merge it in! When it is merged in, your changes will "go live" and you'll be able to see your work on the live website!
-
Congrats on your first foray into open source
software!