In this repository, you will find all of your labs for the semester. We will be leveraging Github to submit and review assignments. This will help us stay organized and expose you to some real-life best practices.
In this README, I’ve provided everything you need to get yourself set up for the semester, along with some helpful reminders.
If you have already completed these steps, skip them.
cmpt221 repositoryYou are going to create your own copy of the cmpt221 repository by forking this one. Forking allows you to work in your own copy of the repository without affecting the original project.
Fork in the upper right corner.cmpt221 since that is what my examples will use, but you can name it whatever you’d like.copy the main branch only is checked.Create fork.calistaphippen as a collaboratorThis allows me to see the activity going on in your repository, create issues, review PRs, etc. even if your repository is private.
cmpt221 repository if you aren’t there alreadysettings in the top menu barCollaborators.Add People and type calistaphippen into the text box. Click Add calistaphippen to this repositoryYou’ve created your repository, but you don’t have the code locally on your computer yet. Clone your repo by clicking the <code> button, and copying the HTTPS URL provided in the drop down box.
Then, open your terminal, command prompt, or git bash and issue the git clone command to clone your repository to your computer.
git clone <your github repo url> <desired location>
For example, if you want your repository named cmpt221 to be stored on your desktop, use the following command:
git clone <your github repo url> ./Desktop/cmpt221
If you do not provide a desired location or name, the repository will be cloned to your current working directory and take the name you gave it in Github.
git clone <your github repo url>
Once your repository is cloned and I’m added as a collaborator, you’re all set!
Submitting a lab in this class might be different than how you submit an assignment in your other classes, but it simulates how your work will be reviewed in the real world.
When a lab is posted, you’ll need to pull it into your own repository. To do this,
go to your cmpt221 repository in Github and click Sync fork then click Update branch.
First, open VSCode. Then, click File > Open. Select your cmpt221 repository. Then, open your terminal by clicking Terminal > New Terminal.
If you are a Windows user, create a git bash terminal by clicking on the drop down next to the plus sign in the upper right hand conrner of the terminal and selecting git bash or bash.
We pulled the lab into your remote repository, but those changes are not yet in your local repository. To pull the changes into your local repository, issue the following command:
# --no-edit avoids creating a commit message, which is fine for this situation
git pull --no-edit
Create a new branch and give that branch the same name as the lab (x = lab #)
# create a new branch named lab-x switch to it
git checkout -b "lab-x"
Work on your lab in the newly created branch. When you’re ready to commit and push your changes, save your file(s), then write up a somewhat detailed and/or entertaining commit message explaining what you’re committing. Please don’t push your changes at once. Instead, complete a section of the lab, then push those changes. You should have multiple commits for each lab.
# important: save your file first!!!
# add changes to staging area
git add .
# commit changes to local repo
git commit -m "your message here"
# push changes to remote repo (Github)
git push
NOTE: The first time you push, you might have to authenticate by signing into Github. You will also need to run the following command to push your new local branch to your remote repository. You’ll have to run this every time you make a new branch to create and push to the upstream branch.
git push --set-upstream origin <branch name>
Once your lab is complete and pushed to Github, go to your cmpt221 repository and click Pull requests in the top menu bar. Click New pull request. Select your repository as the base repository, main as the base branch, and lab-x as the compare branch. Then click Create pull request. Add a title and a description, and click Create pull request. Once the pull request is created, add calistaphippen as a reviewer, copy the link to your pull request from the search bar, and submit it under the corresponding lab in Brightspace.