CompSci 307 Fall 2021 |
Software Design and Implementation |
The following workflow is suggested for your team projects to minimize merge conflicts. It is based on using one branch per person in the team and using Gitlab's Merge Request to share each person's changes with the team.
For team projects, you will clone
the team repository directly (there should be no reason to fork
your own copy) so that everyone is working on the same code base.
clone
the shared team repository:git clone git@coursework.cs.duke.edu:CompSci307_2021Fall/PROJECT_teamNN.git
New -> Open
and select the folder you just created created when you cloned the team repository to your local machineThe advantage of using one branch per person (instead of each package or feature) is that it essentially assures that you are the only one using your branch, meaning you will only need to push
your changes regularly so they are available in Gitlab and can be integrated into the master
branch and you will not need to pull
any new changes.
git checkout -b YOUR_NAME_OR_NETID
git add YOUR_UPDATED_FILES git commit -m "A useful comment for your team mates about this change" git push -u origin BRANCH_NAME
Merge Requests are a powerful tool provided by many online GIT repositories (including GitHub and BitBucket). It creates a web page representing the changes you intend to make to the repository in an easy to understand format that allows others to comment on your changes before accepting them. The request's web page also updates automatically if new changes are committed and pushed.
master
branch on your local machine, use Gitlab's Merge Request tool to manage integrationmaster
as "Target Branch" (master
is the default), then select "Compare branches and continue"pull
those changes down to your branch's local copy before doing the next steps.This step is most likely to contain merge conflicts since you have been coding on your branch without worrying about what the rest of the team has been doing (so the longer you wait to push your code the more likely it is that you will cause conflicts).
master
branchmaster
branch to your personal branch. pull
the changes down to your local repository after finishing. Also, using the web interface means you will never need to leave your branch on your local machine.merge
it directly. This can be more stream lined, especially if there are no conflicts. master
branch on your local machine to pull
down these new changesgit checkout master git pull origin master
master
branchmaster
branchgit checkout YOUR_NAME_OR_NETID git merge master
commit
just for the fixes and push
it up to Gitlab as usual.
git add YOUR_UPDATED_FILES git commit -m "A useful comment for your team mates about this change" git push -u origin BRANCH_NAME