Today we're going to learn git! We're going to pratice cloning, adding, commiting, merging, and resolving merge conflicts! At the end of this lab you'll have a personal webpage that you can access at https://andrewdchen.github.io/HIP-A2CN/docs/ !
-
On Github:
- To clone your respository find the green
Code
button and copy the https link. Make sure you are cloning your version of this repository, not this one. The clone button should look like:
- To clone your respository find the green
-
On your terminal:
git clone <url for your fork>
- On your terminal:
git checkout -b <branchname>
- We're about to make some changes so let's checkout a new branch!
- On your terminal:
cd HIP-A2CN/docs
touch *username*.md
Alternatively, you can make the markdown file via file explorer/finder.
What is markdown? Markdown is a lightweight markup language for creating formatted text using a plain-text editor.[1]. This cheatsheet might be helpful for step 3: Github Markdown Cheatsheet
- Use your favorite texteditor e.g. TextEdit, Vim, Nano, Sublime to add your personalized content!
- On your terminal:
git add *username*.md
git commit -m "*username* initial commit"
Additional practice:
git status
is a useful command for seeing what has changed relative to your latest commit or your HEAD pointer.
- Try
git status
before and after yougit add
. What does the message say? Can you undogit add
? - Try
git status
after yougit commit
, what does the message say? Can you undogit commit
?
- On your terminal:
git push origin <branch_name>
Additional practice: What does origin mean? What does master mean?
- On Github:
- More instructions here: Creating a pull request from a fork
- For step 6, make sure the upstream repository is
andrewdchen/HIP-A2CN
, and the downstream repository is your own with the branch you made just now! - Once you finish step 8, let a TA know in the chat!
- Find your pull request here: https://github.com/andrewdchen/HIP-A2CN/pulls, and resolve the conflict!
- Once you have resolved the conflict, commit the change, and let a TA know in the chat! We will incorporate your pull request and you will be able to see your website at https://andrewdchen.github.io/HIP-A2CN/docs/