- Manage change in a project.
- Collaborate over time and space.
- Fork a repository.
- Clone a repository
- Synchronize repositories locally.
- Synchronize repositories remotely.
Continuing with what we started Git Basics we are going to use Github to manage our project.
So we have a local repository, watch as I create a GitHub repository. Why GitHub? So we can backup our code online. It also provides us with a useful graphical interface and useful collaboration features.
Now create your own GitHub repository and push
your master branch.
The last time we saw Ned Stark we had just written his fate. Below his story write the beggining of another character's story. For instance:
Joffrey Baratheon was the one to do Ned in, but his story was only about to being, and let me assure you he will DEFINITELY NOT DIE!
Push the changes you made.
Also push your dream-story
branch. We pushed our master
branch with the
command git push origin master
. Can you figure out how to push our
dream-story
branch?
Watch as I fork
and clone
one of your repos and make an addition by
creating a pull request
.
Working with a partner follow my example and take turns adding to one another's stories. Accept each other's pull requests. After you've each gone once stop.
Each of you should now have updated code on GitHub, but your local Git repo will be behind. We need to get the latest code off of GitHub. We can do this by pulling the changes that we merged. The command to do this is:
git pull origin master
This get the latest copy of our code off of the master branch of our original repository.
A remote repository is just another repository that you are connected to and depending on your permission you can push code up to it and pull code down from it.
Watch as I add a remote from one of your repositories then update my local with the changes. You will be asked to do this next.
git remote add upstream <"[email protected]/">
is the command to add a remote
called upstream. It's just as easy to pull from it.
Working with the same partner from before one of you will be the primary repository, the other will be a contributor.
-
The contributor will add the primary repository as a remote.
-
The primary will push their latest story to the master branch.
-
The contributor will pull the master branch from the primary.
-
The contributor will add to the story and push their changes to their own repository and create a pull request to the primary.
-
The primary will accept the pull request and pull the changes to their local.
-
The primary will add to the story and push the changes to their master branch.
7.The primary and the contributor will go back and forth adding to the story.
Hey! See that little pencil button on the top of a page on github!? That looks to change text and will help us, right?! [ Wrong! DON'T EVER USE THAT! Regardless of how small changes are you typically never want to edit ON GitHub. You always want to make changes locally and push them. The reason we never want to do that is if you edit in the cloud, our local repo and GitHub repo become out of sync and it breaks convention.
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].