Software Design and Development :: CS 246

07 Teach : Team Activity

Set up Team Git Repo

Objectives

Overview

To ensure that you are ready to begin development in earnest next week, you need to set up the initial project and commit the source to GitHub (if you haven't already done this).

Each team member needs to pull the content down and make at least one push to make sure that everything is configured correctly. In addition, you need to make sure that each person can resolve a merge conflict.

Instructions

Even though this should be straightforward, issues always seem to arise when there are merges and conflicts to resolve, so you may consider having everyone perform their push/pull during a live meeting, so that you can walk through it together.

If you do run into challenges with merge conflicts, you may find it easiest to close down your IDE and work through it on the command line (GitBash on Windows). By going to your project directory and typing "git status", you will often see more information about the state of your repository, as well as good suggestions for the commands you'll want to type next.

Using the built-in Git integration in the IDE seems to work great when everything is going smoothly, but the command line is often the best way to get untangled if the project is in a bad state.

The following steps will guide you through this process.

Part I - Create the project and repository

  1. Have one person create a new project, create a new repository on GitHub, and push the project code to that repository.

    In Android Studio, this can be done in one step by clicking the "VCS" menu and selecting, "Import into Version Control" -> "Share Project on GitHub", which will prompt for GitHub information and perform the task.

  2. Then have this person add each team member as a contributor to the GitHub repository. This is done by going to the repository page in a Web browser and looking in the "settings" section.

  3. Have all the other team members pull the repository and load the project their IDEs.

    In Android Studio, this can be done as follows:

    1. Click the "VCS" Menu, select "Checkout from version control" -> "GitHub"

    2. Enter your repository URL and the directory on your local computer where you want it.

    3. Open the project (it should prompt you to do this immediately after cloning it)

    4. Click "VCS" -> Enable Version Control Integration

    5. Select "Git"

    6. You should now be able to see the Git options on the VCS menu (to commit, push, etc.)

Part II - Push and pull changes and resolve merge conflicts

  1. Have one team member make a change to one of the files (add a comment), commit it, and push it to GitHub. Then have each other teammate do a pull and ensure that you all see the change.

  2. Repeat the previous step for each team member, so that everyone makes a push.

  3. This ensures that each team member has been correctly added as a contributor and has their local project set up correctly.

  4. Have each team member make a change to the same part of the code at the same time (each of you add a different comment on the same line).

  5. Have team member 1 push their changes first. Then have everyone else try to push their changes.

    1. You will find that the other team members need to pull before they can push. This will cause a merge conflict that you will have to resolve.

    2. Look at the file after making the merge, it will show you both your changes as well as the other person's and will require you to handle the conflict.

    3. Address the conflict by leaving both comments in and cleaning up any Git markers such as "=========" or "<<<<<<<<<<<".

    4. Then "add" the file to mark it as resolved.

    5. Then commit the merge, and push it.

  6. Repeat the previous step until each team member has successfully handled a merge conflict.

Congratulations! Your team can now work together on the same code.

Make sure to complete the accompanying quiz for this assignment on I-Learn.