Git Use - AlexisBliesener/Bewitched GitHub Wiki
Overview
This document will guide you through the process of working with Git in our team project. It explains the steps required to contribute your work safely and efficiently by using branches and pull requests.
Following this workflow ensures that:
- Everyone works independently without disrupting others.
- All code is reviewed before being added to the main project.
- The
mainbranch always remains stable and production-ready at all times.
Here's what you'll learn:
- How to create a branch from main
- Connecting Your Branch To Your Card
- How to commit and push your changes
- How to open a pull request (PR)
- Rebasing
- How to request a review
- How and when your work gets merged into
main
You should never work directly on the main branch. Always use a separate branch for your features, fixes, or tasks.
By following this process, we keep the codebase organized, reduce merge conflicts, and maintain high code quality across the project.
Creating a Branch From Main
- Make sure you’re on the main branch and up to date:
- Click Fetch origin, then Pull to get the latest changes.
- Go to the branch dropdown and select New branch.
- Name your branch following our branch naming conventions.
- start with the name of your team (production, programming, art, audio, design)
- add a /
- add the name of what you are working on
- use _ instead of spaces
- ex. programming/goblin_movement
- Confirm that the branch is being created from main.
- Click Create branch, then Publish branch.
Linking Your Branch to a Task Card
- Open the task card that corresponds to your branch (click the task title to open it).
- On the right sidebar, locate the Development section.
- Link the branch you just created.
- Move the card to In Progress on your project board.
Committing and Pushing Your Changes
Work as usual, but make sure you're always on your own branch. Commit your changes regularly and push them to the remote branch as needed.
Rebasing
Rebase frequently to avoid large merge conflicts later on:
- Open the branch tab and click Rebase current branch.
- Select main as the branch to rebase onto.
- Click Rebase.
- If any merge conflicts appear, resolve them immediately.
Opening a Pull Request (PR)
When your changes are complete and tested:
- Go to the Code tab in GitHub, then open the Branches view.
- Find your branch and click it.
- Click the Contribute button, then choose Open pull request.
- Fill out the pull request template thoroughly.
- Assign your lead as a reviewer.
- Move your task card to In Review on the project board.
Requesting a Review
After opening your PR:
- Notify your lead in the #request-review channel on Discord.
- Your lead will review your code as soon as they're able.
Merging into Main
Once your lead has reviewed your work, they’ll notify you:
- If changes are requested, address the comments and re-request a review.
- If your PR is approved:
- Rebase your branch onto the latest main (if needed).
- Merge your branch into main.
Congratulations! Your work is now part of the project.