University of Victoria
Jentery Sayers
Spring 2014
Description
Format
Stipulations
Objectives
Assessment
Policies
#FutureEd
Today we will start using Git and GitHub. Git is version control software, and it will allow us to document and share changes to our work, in a shared repository (or "repo"), throughout the semester. So let's get started. (Of note, a chunk of what's below is based on and inspired by this excellent introduction by Lauren Orsini.)
git help
(lists popular Git commands; handy!)git config
(configure Git)git clone
(clone all files in a repo; you'll likely just do this once)git add
(add file contents to the index)git commit
(record chagnes to the repository)git diff
(show changes between commits and the repository's "working tree")git fetch
(download objects and refs from another repository)git grep
(print lines matching a pattern)git log
(create an empty Git repo or reinitialize one)git mv
(move or rename a file or directory)git pull
(fetch from and merge with another repository)git push
(update remote refs along with associated objects)git rm
(remove files from the working tree and from the indexgit status
(show the status of the working tree)cd
(change the directory; not specific to Git)touch
(create a file; not specific to Git)git config --global user.name "Your Name"
. Replace "Your Name" with your name as you would like it to appear in the metadata for your contributions to our GitHub repo. When tracking changes, Git attributes each change to a particular name/identity, no matter how small the change.git config --global user.email "emailaddress@email.ca"
. Replace "emailaddress@email.ca" with the email address you registered with GitHub. Note: this is very important. Make sure you don't enter the wrong address.git clone https://github.com/uvicmakerlab/english507
. You should then be prompted for your GitHub handle and password (because the repo is not public). This command will not execute if you are not connected to the internet.cd ~/english507
. Just in case you're curious, cd
stands for "change directory," and the use of ~/
means the repo is located at the top level of your computer's file structure.git init
.touch yourlastname/yourlastname.md
, replacing "yourlastname" with your last name. The first "yourlastname" is the subdirectory, which will be dedicated to your work throughout the semester. Keep in mind that your last name will not start with a capital letter. Also, if your last name consists of two or more words, then they should be joined, without spaces, using capital letters (vanNielsen).git add ~/english507/yourlastname/yourlastname.md
, replacing "yourlastname" with your last name. Of course, if you want Git to watch in the entire directory (instead of a single file), then you can just write git add ~/english507
.git commit -m "First commit of yourlastname.md. My first commit"
, replacing "yourlastname" with your last name. The use of -m
adds a message to the revision history, describing what changes were made. These messages become informative over time, especially if you are collaborating with other people.git remote -v
. This verifies the repo to which you are connected. If the result is not our 507 repo, or you get an error, then set the repo using git remote add origin https://github.com/uvicmakerlab/english507.git
. That will properly establish your remote repo (at GitHub).git push origin master
. If the command is successful, then you should get a list of changes in the command line. You can also check our repo to verify your changes are there. If they are not, then wait at least ten to fifteen minutes before you get concerned. There's the occasional lag.git add ~/english507
to "stage" your revisions prior to committing them. Once they are staged, you can commit changes using git commit
and push them to GitHub using git push origin master
.git pull https://github.com/uvicmakerlab/english507
. This command will sync your local repo with our repo with GitHub. If no differences exist, then it will tell you your repo's already up-to-date.That's it for now! You can of course do much, much more with Git and GitHub, but during the first few weeks of seminar we'll keep it simple. Get in touch with any questions or concerns you have.