Before the lab
Reading
- Read FICS unit 3
- Read the first two sections of Stepper documentation
- Read the documentation for check-expect, check-random, check-satisfied, check-within, check-error, check-member-of, check-range
- Read FICS unit 3
Git Practice: Working with multiple git repos
- Time
- 15-30 minutes
- Activity
- Individual work, outside scheduled lab time.
Cloning
Open a terminal.
Make a directory
lab2-scratch
somewhere outside thecs2613
git repository you created earlier.Now move to the
lab2-scratch
directory, and make a clone of the central repo.$ git clone -b main https://$username@vcs.cs.unb.ca/git/cs2613-$username cs2613-clone
This creates a new directory "cs2613-clone" containing a clone of your repository. Notice that in general this is a good way of checking that your work is properly submitted. The TA and Prof will do exactly this cloning step in order to mark your work. The clone is on an equal footing with the original project, possessing its own copy of the original project’s history.
Sharing changes with a central repo
Optional, but useful if you plan to run git on your own computer
Open a terminal
Navigate to the
~/lab2-scratch/cs2613-clone/journal
directory.create a new blog entry, and commit it.
Push your changes back to the central repository.
$ git push origin main
Change directory to your original directory
~/cs2613
. Bring in the changes you made$ git pull origin main
This merges the changes from the central copy of "main" branch into the current branch. If you made other changes in the meantime, then you may need to manually fix any conflicts.
The "pull" command thus performs two operations: it fetches changes from a remote branch, then merges them into the current branch.
Questions
Here are some questions we will be discussing at the beginning of L03.
- What is a remote?
- What is merging?
- What is a conflict?
Git next steps
Congratulations, you now know enough git to finish this course.
There is lots more to learn, particularly about branching and collaboration. If you want to get a big(ger) picture view, a good place to start is Git Concepts Simplified.