This is the Git workflow my team used for our SWEN-261 group project at RIT: one branch per task, small commits, and a pull request to merge into main. Each step has the command and a filled-in example you can copy.
TLDR
- Clone the repository once.
- Pull main before you start.
- Create and push a branch for your task.
- Check the status, add your files, and commit.
- Push your branch and compare it with main.
- Open a pull request on GitHub.
- After the merge, everyone pulls main.
Git workflow diagrams


Left: Sandra Winkler – Git Workflow.
Right: Molly Nemerever – Git Workflow
Clone
git clone <project_name>git clone https://github.com/RIT-SWEN-261-04/team-project-2215-swen-261-04-2-the-reading-roomPull
Always pull code first!
How to pull from main:
git pull <full-url>git pull https://github.com/RIT-SWEN-261-04/team-project-2215-swen-261-04-2-the-reading-room🌸👋🏻 Enjoying this post? Get the next issue of [ret]2read. Once a month, I’ll email you whatever’s on my mind, usually Apple security research, offensive security, open source software freedom, and operating system internals.
Branches
Create new branch:
git checkout -b <name-of-branch>git checkout -b olivia-login-unit-testsPush your new unedited branch to GitHub:
git push origin <name-of-branch>git push origin olivia-login-unit-testsHow to switch to a branch:
git checkout <name-of-branch>git checkout olivia-login-unit-testsIf needed for some reason, you can switch to main branch:
git checkout mainStatus
Check the status of changed files:
git statusWant your company or product in front of [ret]2read readers?
One sponsor per issue →
Add
Add or “stage” file to be included in the next commit:
git add <changed-file-name>git add olivia.txtThis is considered bad practice. However, you can add all of the changed files in the branch (two ways):
git add -Agit add .Commit
Committing with a message:
git commit -m "<text>"git commit -m "added contact information to olivia.txt"Push
Push your commits and set your branch to track its copy on GitHub:
git push --set-upstream origin <name-of-branch>git push --set-upstream origin olivia-login-unit-testsCompare your branch with main before you open a pull request:
git diff main...<name-of-branch>git diff main...olivia-login-unit-testsPull Requests
We opened pull requests in GitHub’s web interface:
- Go to https://github.com/.
- Navigate to the project.
- Click branches (image 1)
- Click pull request (image 2)


Notify and Pull
Notify group members about merge. Then, have everyone pull from main.
How to pull from main:
git pull <full-url>git pull https://github.com/RIT-SWEN-261-04/team-project-2215-swen-261-04-2-the-reading-roomPull main branch to your branch:
git pull origin mainResources
- Oh Shit, Git!
- Oh Shit, Git! If you find git confusing, don’t worry! You’re not alone. People who’ve been using it every day for years still make mistakes and aren’t sure how to fix them.
- Git is hard: screwing up is easy, and figuring out how to fix your mistakes is fucking impossible. Git documentation has this chicken and egg problem where you can’t search for how to get yourself out of a mess, unless you already know the name of the thing you need to know about in order to fix your problem.
- Learn Git Branching
- Interested in learning Git? Well you’ve come to the right place! “Learn Git Branching” is the most visual and interactive way to learn Git on the web; you’ll be challenged with exciting levels, given step-by-step demonstrations of powerful features, and maybe even have a bit of fun along the way.
Conclusion
If you found this workflow helpful, check out my other articles for SWEN-261 and my offensive security cheatsheet for CSEC-202, Offensive Security Attack Phases and Frameworks.


You must be logged in to post a comment.