# 2 - Git and Github

## Practice Day Saturday

We will do the practice assignment provided on [Git and GitHub Practice](https://syllabus.migracode.org/course-content/introduction-2/git-and-github-practice-session) page during Saturday's session of second week. There are additional practice projects mentioned at the end of the page. You can find the practice section on MigraCode syllabus website under Introduction section or follow this [link](https://syllabus.migracode.org/course-content/introduction-2/git-and-github-practice-session).&#x20;

## Suggested Homework

**Exercise 0:** Upload your first Migracode GitHub project (2 Hours)

Before you started this bootcamp, you have built a website in CodePen and learned the basics of HTML and CSS. Now it's time to learn about the tools that web developers use in their everyday job. These tools will be used during the course, so it is important that you become familiar with them and use them every day.

#### How to move your code to Github

1. Export your website as a zip file from CodePen. [Help >](https://blog.codepen.io/documentation/features/exporting-pens/)
2. Extract the contents of the zip file to a folder on your computer. **Make a note** of the location of this folder.
3. Upload the contents of this folder to a Github repository. To do this, you first need to create a new repository in your account on GitHub that has exactly the same name as the folder of the website on your computer. To upload the code from your computer into your GitHub repository: make sure you are in the directory where you have your website code (use `cd` to get into that directory). Then use the `git add .`, `git commit -m "Your message"` and `git push` commands as explained.
4. You should now have a repository with your code in your GitHub account: `http://github.com/your-username/your-repository-name`. Here you can see your code, and there should be an overview of your files, including an `index.html` file.
5. Publish your website following [these instructions](https://syllabus.migracode.org/git#publish-your-website-in-github-io-with-github-pages).

**Exercise 1:** [Go through the Try Git Guide](https://try.github.io/)

**Exercise 2:** Learn [How to file a github issue](https://guides.github.com/features/issues/).

**Exercise 3:** Watch these videos:

* [First Look](https://www.youtube.com/watch?v=SCZF6I-Rc4I)
* [Setup](https://www.youtube.com/watch?v=7Inc0G0wutk\&feature=iv\&src_vid=FyfwLX4HAxM\&annotation_id=annotation_549442395) (dont worry about GUI setup)
* [commit](https://www.youtube.com/watch?v=A-Cll9jEnnM\&feature=iv\&src_vid=WxMFZncm12s\&annotation_id=annotation_2715859739)
* [log](https://www.youtube.com/watch?v=Ew8HQsFyVHo)
* [Remove](https://www.youtube.com/watch?v=jtuHOIlfS2Q)
* [Diff](https://www.youtube.com/watch?v=RXSriVcoI70\&feature=iv\&src_vid=A-Cll9jEnnM\&annotation_id=annotation_1859558535)
* [Reset](https://www.youtube.com/watch?v=BKPjPMVB81g)
* [Rebase](https://www.youtube.com/watch?v=SxzjZtJwOgo)

**Exercise 4:** Skim [Hadley Wickham's guide to git](http://r-pkgs.had.co.nz/git.html) for an additional refernce.

**Exercise 5:** Create a repo on GitHub that contains a markdown file that answers these questions:

* How do you see the files changed within each commit from git log?
* How do you see the contents of what changed within each file from the git log?
* What does `HEAD` refer to in the context of git? (Not to be confused with the "HEAD<<<<" one observes within merge conflict)

## Feedback

{% hint style="info" %}
We can always improve thanks to your feedback, you can use this document to send your ideas or suggestions on every week. \
This [document ](https://docs.google.com/document/d/1AzqbpWri4cyeqqf8TVHIovfdRYWOdONsYU01LVvdPvI)will help us to improve Syllabus and this guide
{% endhint %}
