This is a simple introduction to git and github. We'll be making several branches and commits to files in this very repository. Everything will be in markdown, so you won't need to know any specific language (other than markdown obviously).
Let's learn some git!
NOTE Some of this is probably going to seem incomplete. You are going to help build this workshop! You'll see WIP scattered about. That just means the section is Work In Progress.
Git (and github) is not just a tool for version control. It's also a communication tool. We should strive to be excellent communicators. We are going to practice communicating here in this workshop.
WIP
Just like a fork in a path, a repository fork is the start of a new bit of code but it shares the same history as the original code base.
- Fork this repository
- Clone it to your local machine
WIP
Repositories are where your code physically resides. Local, remote, on your computer, in Github.
Question: Name all the repositories that share a common history with this code base
WIP
Branches are kind of like forks, but they are contained withn a repository. Branches are cheap, so we want to use them often.
WIP When should we branch?
Let's add some files that link to other great programming resources on the web.
TODO: Add commands to branch here
- Create a new branch
- Make a new file
WIP
Commits are little saved change to a repository. They also communicate to your fellow teammates and your future self.
- Add an interesting resource to your file.
- Commit that change.
- Add a link to your file from this README file
- Commit that change.
- Now edit the file and add some things to the top and bottom of the file
- Commit only the changes to the bottom of the file
Note: Use good communication skills.
Question: What are some examples of good commit messages?
TODO: Discuss the different ways to git add
WIP
Pull requests are when you request that someone pull in your changes to a repository. Sometimes they are called merge requests (depending on the provider you are using)
- Push your changes to your fork
- Make a pull request (remember to use good communication)
- See if someone will merge it in.
Question: Think about the changes you just made. Where are they?
WIP Remotes are just remote repositories. Git keeps these handy for you so you can easily get code from different repositories.
- Add this repository as
upstream
- Pull the upstream changes.
Question: What's the difference between fetch and pull?
WIP How to track upstream? When to push/pull?
WIP
Keep track of your things to do.
Git keeps a history of all changes ever made.
Question: Why would this be helpful?
Use the CLI, figure out what my cat's name is. Hint: This file originally contained my cat's name.