While using git locally is a wonderful way to track our revisions and enable us to rollback to previous versions, in order to take full advantage of git we'll use GitHub. GitHub is a service where we can replicate (copy) our repository and collaborate with others.
A GitHub Account
Your guide will set up a repository for your use for this assignment. Be sure to follow the instructions carefully. In order to participate, you'll need a GitHub account. GitHub accounts are free to create.
- Go to https://github.com
- Click on the button at the top, right-hand side of the page
- On the next page ("Set up your account") there will be a short form:
- Create a unique (and appropriate) username
- Provide an accessible email address, as directed by your guide
- Provide a password
- You may receive a small puzzle to solve; if so, solve the puzzle
- Click on the "Create Account" button
- On the next page you may have a brief survey. At the bottom, click the "Complete Setup" button
- You'll receive an email to the address you specified.
- Check your email client and find the email from GitHub
- Click the button
In order to use these commands with a remote repository, it's best to cache your credentials. On the command line, execute:
In order to squelch the warning that occurs while pushing, execute:
Note: These commands, if successful, will complete silently.
Your guide will create a GitHub assignment for you. You'll receive an email with an invitation link.
- Sign in to GitHub using the correct account BEFORE clicking on the link
- Click on the link
Joining the Classroom Roster
The first time that you click on an assignment you'll be asked to join the classroom roster. You'll see a message similar to: "Join the classroom roster: Your teacher has configured this classroom to pair GitHub accounts with identifiers."
- Click on your identifier. (Do NOT skip this step.)
- The next page will present you with an . Click the button.
- You'll may see a progress bar (or two). Be patient as your assignment is prepared. When the assignment is ready, you'll see the message: "You are ready to go!"
- They'll be a link at the very bottom of the page, immediately after the text "Your assignment has been created here:" Click on that link. You'll need this link in a subsequent step in this experience.
First GitHub Assignment
Your first GitHub assignment will be to sync all of your journals with GitHub. In order to do so, you'll need to specify a GitHub URL as your "remote" for your existing git repository.
Enter your Journals directory:
Remember that you've already added all of these files to your local git repository. You can easily verify this by checking the status.
You should see something similar to:
Let's add the remote. To do so, we'll need the URL from the above assignment. It will be something similar to:
Be sure to use your own url, which will be unique to you.
Then, we can push our local commits to the remote server:
You'll then be promoted to enter your username and password. Remember to use your GitHub username and password. After the push is completed, go back to the browser and refresh the page.
The workflow when using a remote repository is very similar to that using only a local repository, with the exception of push and pull.
addthe files to the staging area
committhe files to the repository
pushthe local repository to the remote
The most significant difference is that we'll need to keep in mind that others may also be working on the remote repository, so we'll need to sync their remote changes with our local repository. The best practice is to perform a
pull prior to beginning work in the working directory.
As you progress through your work, whether it be code or prose, you'll accumulate more and more commits each with their own version of a particular file. There'll be times when you'll need to mark a specific commit. For example, you may want that commit to be reviewed by your editor or by quality assurance personnel. Git is able to mark specific points in the repository as being important. This process is called tagging and the mark itself is called a tag. It's important to note that the entire repository at a given point in time is tagged, not a particular file or group of files.
A tag can be placed on the repository with the following command, replacing tagName with the actual name of the tag.
Pushing a Specific Tag to a Remote
A tag may be pushed to a remote repository with the following command:
Deleting a Tag Locally
A tag may be deleted locally with the following command, replacing tagName with the actual name of the tag.
Deleting a Tag from a Remote
A tag may be deleted from a remote with the following command, replacing tagName with the actual name of the tag.
|Knowledge and skills||§10.231|
|Topic areas||Source control systems|
|Classroom time||60 minutes|
|Study time||3 hours180 minutes <br />|
|Acquired knowledge||understand the purpose of a source control system when working with multiple users|
|Acquired skill||ability to push and pull changes to/from the source control system|
ability to use a source control system to merge changes
ability to properly handle merge conflicts