Sample Git Workflow

General Git Workflow Diagrams

Image 1: Sandra Winkler – Git Workflow

Image 2: Molly Nemerever – Git Workflow

This is Group 2’s sample Git workflow for Introduction to Software Engineering (SWEN 261).

Clone

git clone <project_name>
git clone https://github.com/RIT-SWEN-261-04/team-project-2215-swen-261-04-2-the-reading-room

Pull

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

Branches

Create new branch:

git checkout -b <name-of-branch>
git checkout -b olivia-login-unit-tests

Push your new unedited branch to GitHub: 

git push origin <name-of-branch>
git push origin olivia-login-unit-tests

How to switch to a branch:

git checkout <name-of-branch>
git checkout olivia-login-unit-tests

If needed for some reason, you can switch to main branch:

git checkout main

Status

Check the status of changed files:

git status

Add

Add or “stage” file to be included in the next commit:

git add <changed-file-name>
git add olivia.txt

This is considered bad practice. However, you can add all of the changed files in the branch (two ways):

git add -A
git add .

Commit

Committing with a message:

git commit -m "<text>"
git commit -m "added contact information to olivia.txt"

Push

Add to your branches up main:

git push --set-upstream origin <name-of-branch>
git push --set-upstream origin olivia-login-unit-tests

How to check your branch against main branch:

git checkout main

Pull Requests

We have been doing them through GitHub’s user interface.

  1. https://github.com/
  2. Navigate to project. In our case, https://github.com/RIT-SWEN-261-04/team-project-2215-swen-261-04-2-the-reading-room.
  3. Click branches (image 1)
  4. Click pull request (image 2)
Image 1: Click branches
Image 2: Click pull request

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-room

Pull main branch to your branch:

git pull origin main