Github and Github Desktop - Week 1
- You will be able to create a repository on Github
- You will be able to clone a repository using Github Desktop
- You will be able to make changes to a repository using Github Desktop
- You can define what the differences between Git and Github are
- You can use git to submit all your homeworks to Github
It is important that all of the attendees have access to the CodeYourFuture Github Teams. Make sure that they have all been added and if they haven't add them.
What is the problem?
When programmers work together it can be hard to stay in sync. This can be demonstrated by:
- Have one person write three words on a piece of paper
- Give the paper to the teacher and the teacher makes a copy of it
- Somebody else can request the paper from the teacher
- Change a word on the paper and give it back to the teacher.
The teacher is the single source of truth for the project. This is fine so long as both people don't make a change at the same time.
- Now both students change a word on their piece of paper
- They then try to give both pieces of paper to the teacher
- But the teacher doesn't know what to do! Which one is correct?
This is why Git was invented!
What is Github?
Give an overview of Github including
- A Project Overview
- Creating a repository
- Changing a file in a repository
Glossary - Repository - A repository is like a folder on your computer. It can hold a lot of other files. Glossary - Commit - When you commit - you are saving the file to your repository
All students should now complete the following steps
1. Create a repository called "Code Your Future". 2. Create a file in their repository called `ReadMe.md` 3. Edit the ReadMe.md inside Github to include their name.
What is Github Desktop?
Github Desktop is a way to edit files on your computer instead of editing them online.
Give a demonstration of
- Cloning a repository
- Making a change to a file in the repository
- Committing the changes to our local repository
- Pushing our changes to Github
Glossary - Clone - Clone means to create a copy of the repository on your laptop Glossary - Push - Push means to send your saved copy of the repository to Github Glossary - Fetch - Find out if there have been any changes to the repository Glossary - Pull - Get the latest changes from the repository
The students should now complete the following steps
1. Clone their repository called `Code Your Future` to their computer 2. Fetch to find out if there have been any changes on Github 3. Pull the changes that have happened from Github recently 4. Change the "ReadMe.md" file to also include the city they live in 5. Commit the change they have made 6. Push the change to Github
Each person in the group should try this
What about working in Teams?
Github also makes it really easy to work in teams.
One way that we could work in a team is by making a list of our favorite things.
In your teams you should
- Each clone this repository to their computers
- Each team member should take it in turns changing one work in the ReadMe.md file in the project.
- Make a list of your favorite things. This can be food, hobbies or places. It's completely up to you!
Be careful! Don't all add words at the same time!
Sometimes it can be useful to work on something for a long time before showing it to everyone. This is why we use branching.
The teacher should
- Show how you can create a branch in Github Desktop
- Show how moving between Master and the Branch keeps two versions of the file
All students should now
1. Create a branch called "my-favorite-stuff" 2. Edit a file to add something that is your favorite 3. Commit your change to the file 4. Push your commit and your new branch to Github
Branching is particularly helpful for using in Pull Requests
- The teacher should show how to make a Pull Request in Github
- The teacher should show how to comment on a PR in Github
- The teacher should show how to merge a pull request in Github
Now the students should try this themselves
1. Each student should go to this repository - https://github.com/CodeYourFuture/GitTeaching 2. They should open a pull request 3. Share the link to their pull request in Slack with the rest of the class
(Optional) What is Git?
This is advanced!
The Github Desktop tool is actually built on top of something called Git. Git lives entirely in the command line.
The teacher should show
- How to clone a repository
- How to make a commit
- How to how to push to the repository
This is only to show students how it's done! We'll be doing more of this in the future.
- What is a repository?
- A repository is like a
- What is Github?
- What is git?