Setup Seaside and cse374

For this assignment, you must use your account on seaside.cs.washington.edu. See the Setup page from hw0 for more information about how to get started. We recommend that you use Visual Studio Code for this homework.

You should also have cse374 set up from hw1. See the Setup page from hw1 if you need help. Once you have mounted the ~/udrive/cse374 in ~/cse374, just cd ~/cse374 to work in that directory.

Setup Git on Seaside for git operations

Exercise 5 has detailed instructions on how to set up SSH keys to GitLab. You can ssh -T git@gitlab.cs.washington.edu to check whether you are on the machine with SSH key setup. If you see a welcome message, that means you are good to go. If you see a prompt about passwords, that means you need to redo the steps in that exercise to set up another SSH key on the machine.

Work in your own git repo

You should have cloned your own git repo from hw3. See the “Clone your own git repo” section if you need help. After cloning the repo, change directory to the local copy of your repository: cd cse374-23su-UWNetId.

Make sure your remote configuration is setup correctly by running git remote -v. It should output:

origin  git@gitlab.cs.washington.edu:cse374-23su-students/cse374-23su-UWNetId.git (fetch)
origin  git@gitlab.cs.washington.edu:cse374-23su-students/cse374-23su-UWNetId.git (push)
upstream        git@gitlab.cs.washington.edu:cse374-23su-students/cse374-23su-hw.git (fetch)
upstream        git@gitlab.cs.washington.edu:cse374-23su-students/cse374-23su-hw.git (push)

In this configuration, the origin (default) remote links to your repository where you’ll be pushing your individual submission. The upstream remote points to our repository where you’ll be pulling subsequent homework and bug fixes.

Pull starter code from the upstream repo

Caution

If you have made any changes to your own repository, commit them before proceeding to the git pull. Otherwise, the merge step might fail.

You will need to pull updates from the cse374-23su-hw repository to get the actual files for hw5, and then upload it.

git pull upstream hw5
git push

When you pull the code, Git may open a text editor to allow you to specify a merge commit message; you may leave this as the default. Note that these changes are merged locally, but we will eventually want to push them to the GitLab repository (git push).

Note

if you have a newer version of Git, you might get a fatal: refusing to merge unrelated histories error. If so, please run the following: git pull --allow-unrelated-histories upstream hw5.

I have a merge conflict! What should I do?

If you get a merge conflict, don’t panic! Run the git status command to identify the files with conflicts. Git will mark these files as “both modified.”

Find merge conflict

Then, Use a text editor to open the conflicting file(s). In the file, you’ll find sections with conflict markers like <<<<<<<, =======, and >>>>>>>. These markers indicate the conflicting sections. Analyze the conflicting sections to understand the changes made on both branches. The conflicting sections will show the differences between the two versions.

Before resolving the conflict

Edit the conflicting file(s) to resolve the conflict manually. You have several options:

  • Accept current branch’s changes for hw3 and hw4 files: If you want to keep the changes from the branch you’re currently on, remove the conflicting lines with the conflict markers (<<<<<<<, =======, and >>>>>>>), leaving only the desired code.
  • Accept incoming branch’s changes for hw5 and .gitignore files: If you want to discard the changes on your current branch and keep the changes from the incoming branch, remove the conflicting lines and markers from your current branch’s changes.
  • Combine changes: If you want to keep some parts of both sets of changes, modify the conflicting sections manually to merge the changes in a way that makes sense for your project.

After resolving the conflict

After you’ve manually resolved the conflicts, save the file(s).You may now stage the changes by running git add . and make an commit git commit -m "Resolved merge conflict for hw5". Finally, push the changes to the remote repository with the command: git push.

🎉 Congratulations! You have successfully pulled starter code from the cse374-23su-hw repository into your own repository. Now, you can cd hw5 and start working on hw5!

Tip

Commit early and often! Any time you commit and push your local changes, they will appear in the GitLab repository. Since you’ll be submitting the homework to Gradescope via the GitLab repository, it’s important that you remember to push all of your changes!