CompSci 308
Spring 2023
Advanced Software Design and Implementation

Lab Exercise: Using GIT in Teams

Work together as a team to practice working in branches, merging changes, and dealing with merge conflicts. By alternating edits to the same file, you will practice working in parallel and experiment with what kinds of changes GIT can process automatically and which changes must be merged by hand — use this lab to practice dealing with these conflicts.

When working on a team project, you will need to develop a flow of working that minimizes potential conflict between each person's new code, while regularly integrating the team's work so no one gets too far behind. The easiest way to do this is to give each person on the team their own "personal work space" to make changes and manage how these changes get integrated together. In this course, we suggest this general workflow in this course which is similar to the common practice of "protecting" the master branch, minimizes merge conflicts, and maximizes team involvement in the process of creating a combined codebase.

Inevitably, conflicts will occur and they should be used as opportunities to think about and collaborate on how best to resolve distinct changes to the same piece of code.

Resources

Experiment with Merge Conflicts

Everyone will be making a lot of small edits (e.g., in comments or by creating new text files) so it may help to set little "goals" to keep track of what exactly you are trying to accomplish with each set of changes. If you have trouble coming up with your own goals, you can follow this exercise that makes a combined poem.

Start by creating a single file to edit, doc/MERGE_PRACTICE.md, in the default master branch of your team project repository and make a series of tracked changes using the standard GIT commands (add and commit):

After each person is able to merge from their personal branch to master (and back) using the command line, take turns trying to do it again using a Merge Request:

The command line takes place on your local machine, the Merge Requests take place on the Gitlab server, and each offers a different experience with the process of integrating the changes. We think using Merge Requests is helpful for integrating your changes with the team's code and allowing your team mate's to inspect those changes. You are welcome to use whichever style (command line or website) you are most comfortable with to manage your merges.

More Practice

If you feel like you want more practice (now or later), try make more changes similar to these excellent online tutorials: