- Explain the difference between cloning and forking a repo
- Explain the uses of Git and GitHub for tracking changes and collaborating on projects
- Write some code to improve their work, commit the changes, and write a strong commit message
- Deploy their first live website using gh-pages
- What does it mean when we say Git is a distributed version control system vs centralized?
- Why do we need Git?
- Revert files back to a previous state
- Revert the entire project back to a previous state
- See who introduced an issue and when
- Automation, deployment
- Benefits of working locally
- Speed
- Don't need to be connected to the internet to save progress
- Free to experiment without impacting others
- Working with Git
- Working directory
- Staging area
- .git repository
- States
- Untracked
- Unmodified
- Modified
- Staged
- Commands
git init
git add
git status
git commit
git log
git branch
git checkout
git merge
- work in teams
- backup our data in case our machine crashes
- resume
- social
A clone is a copy of an existing repository. We can create as many clones as we want, wherever we want.
Forking creates a copy of someone else's GitHub repo to your GitHub account. The forked repo is not perfectly identical - but it includes all the same source files, issues, and commit history.
- Used for open source contributions so that not everyone has to have write access to the code in order to contribute
- Propose bug fixes
We Do
git clone git@github.com:ga-students/wdi-atx-7-class.git
Search for any popular repository and show how easy it is to fork into our own repository
NOTE: Students will be using a variation of the following link to submit homework:
https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow
- Fork the homework repo
- Clone your version of the repo
- Add a remote
upstream
- To get the latest updates, they will run
git pull upstream master
- They will then submit a pull request
Initialize the repo with a README or there won't be a master branch
You Do
Clone the repository you just created on GitHub
git push
/ git push origin master
git fetch
- Obtains the latest updates from the remote repositorygit merge
- Merges the new updates with your existing working copygit pull
- A combination of both fetch and merge
Update the class repo with the Git Haiku class exercise. Have the students do a git pull
to get the updates
20 min
https://gist.github.com/mdang/e6b45f9554a64c8d44fd
Why create pull requests? What are they used for?
2 min
- Describe the most important thing you learned about Git today
- What is most confusing?
origin
is not special, it's the default name given when you clone a git repo
To view remote branches, use:
git remote -v
git push origin testing
git push origin --delete serverfix
20 min
https://gist.github.com/mdang/9ef6df246e23a795936b