Skip to content

Completing a Task

catglossop edited this page Oct 22, 2022 · 5 revisions

Completing and Merging a Code Task

To make submitting and merging code easier and more organized, here is a quick guide on how to set up your task with the repo.

Step 1: Creating your branch

To get started, go to your local repo on your computer (or docker container) and make sure it is up to date with master

cd <location of repo> 
git checkout master (if not already in master) 
git pull 

Now we create a branch for the new task

git checkout -b feature/<name_of_task> 

This will bring you into your development branch.

Step 2: Development

Now that you have your branch set up, you can develop. Any changes you make in this branch will be separate from master. It is good to regularly push your code. On your first push

git add <your modified files> 
git commit -m "<your message>"
git push -u origin <name of branch> 

Note: Remember to keep progress on your task up to date on Kanban as well!

Step 3: Preparing for a pull request

Once you have finished your code and think it is ready for review, you can create a pull request. But first, you must merge any changes to master into your branch in case any new code was added to master since you created your branch. After you have committed all your files,

git checkout master 
git pull
git checkout <your branch>
git merge master

There may be some conflicts. Use the built-in VScode conflict resolving interface to fix any of these issues (make sure you keep any new changes to master that are not modified by your code and you keep all of your changes)

Once the conflicts are all resolved, you can add and commit all the modifications and do a final push

git commit <all files> 
git push 

Now you can create a pull request.

Step 4: Creating a pull request

At the top of this page, you will see a pull requests tab

PR

Go to this tab and click "New Pull Request"

New PR

Now select the branch you'd like to merge into master for the "compare" branch

compare

Now you can write a description of the change you made and what they do in your pull request. Try to cover these major topics:

  1. What does this change do?
  • What component is this related to? (sensors, autonomy, platform etc.)
  • What other components does this change affect?
  • Is this change competition related or for general rover functionality?
  1. What will be required to revert it? (Remove the files, revert to an old version of a file, etc.)
  2. Any other comments you feel are important

Step 5: Review and Changes

After the PR has been submitted, one of the leads will review your code and make any comments/request any necessary changes. In the future, we will also have a CI/CD pipeline to improve the integration of new code.

Any changes will be added to the PR when you push new changes to your branch, as usual. After the changes have been approved, your branch will be merged into the main repo and your development branch will be deleted.