Week 9 [Mon, Oct 14th] - Tasks

  1. Submit the quiz

Project:

  1. Implement increments Level-8, A-JavaDoc, A-Gradle, A-JUnit
  2. Merge branches

Project

1 Implement increments Level-8, A-JavaDoc, A-Gradle, A-JUnit

Duke Level-8: Dates and Times

Duke A-JavaDoc: JavaDoc

How do I fetch the add-gradle-support branch from my fork?


If your fork doesn't have the add-gradle-support branch ...


Duke A-Gradle: Gradle

The A-JUnit project increment given below can be done using Gradle or without using Gradle. It's easier if you choose to do it using Gradle.

Duke A-JUnit: JUnit Testing

2 Merge branches

This task is optional but strongly recommended.

To get a very basic sense of how to use Git in a team project, this exercise simulates a situation where some others are also writing code for your project. Here are the steps.

  1. Imagine you are using the GitHub repo https://github.com/nus-tic2002-AY2425S1/duke to collaborate among the team members of your Duke project.

Although that repo was set up by the teaching team, you could have created one yourself -- all it requires you to do is to create a GitHub organization, create a repository inside it, push your code to it, and add other team members to that GitHub organization.

Alternatively, you could have added the team members as 'collaborators' to your own fork so that they can push code to your fork directly.

  1. Now, imagine one of the team members have pushed her new code as a branch named tweak-readme to the remote repo (we have added such a branch to that repo already). Fetch that branch and merge it to your master branch.
    • Here are the steps for doing that, using the Git command line.

      1. Add the upstream repo as a remote, and give it the name upstream:
        git remote add upstream https://github.com/nus-tic2002-AY2425S1/duke.git
      2. Switch to the master branch, if you are not on it already:
        git checkout master
      3. Fetch the tweak-readme from the remote upstream:
        git fetch upstream tweak-readme
      4. Merge the branch (the --no-ff tells git not to use a fast-forward merge):
        git merge --no-ff upstream/tweak-readme
    • Alternatively see the panel see the panel below on how to pull a branch from another remote.
      In this case, the remote to pull from is https://github.com/nus-tic2002-AY2425S1/duke.git, and the repo to pull to is your local repo used for the project.

  1. Suppose another member has pushed another branch add-details-to-readme to the same remote repo. Pull that one too and merge it. If there is a merge conflict, resolve it too.
  2. Push your master branch to your fork.