Did you know? Research improves critical thinking skills.

GitHub Workflow (GitHub Flow) explained

GitHub Workflow (GitHub Flow) with Example

GitHub Workflow (GitHub Flow) – Step by Step

What is GitHub Workflow?

GitHub Workflow (GitHub Flow) is a simple branching model where developers create a feature branch, make changes, push to GitHub, create a Pull Request, review, and merge into main branch.

Step 1: Clone Repository

git clone https://github.com/user/project.git
cd project

This downloads the project from GitHub to your local machine.

Step 2: Create Feature Branch

git checkout -b feature-login

A new branch is created for your work so main branch stays stable.

Step 3: Make Changes and Commit

git status
git add .
git commit -m "Added login feature"

You save your changes locally with a commit message.

Step 4: Push Branch to GitHub

git push origin feature-login

Your feature branch is uploaded to GitHub.

Step 5: Create Pull Request (PR)

On GitHub website:

  • Open repository
  • Click Compare & Pull Request
  • Add description
  • Click Create Pull Request

PR is used for code review before merging.

Step 6: Code Review & Approval

Team members review code, suggest changes, and approve PR.

Step 7: Merge Pull Request

After approval, PR is merged into main branch.

Step 8: Pull Latest Code

git checkout main
git pull origin main

Your local main branch is updated with merged code.

Handling Merge Conflict

<<<<<<< HEAD
System.out.println("Hello");
=======
System.out.println("Hi");
>>>>>>> feature-login

Resolve conflict manually, then:

git add file.java
git commit -m "Resolved conflict"

Complete GitHub Workflow Diagram (Text)

Developer → Feature Branch → Push → Pull Request → Review → Merge → Main Branch

Advantages of GitHub Workflow

  • Main branch always stable
  • Easy collaboration
  • Supports CI/CD easily
  • Simple to understand

Important Git Commands

ActionCommand
Clonegit clone URL
Create branchgit checkout -b branchname
Add filesgit add .
Commitgit commit -m "message"
Pushgit push origin branchname
Pullgit pull origin main
Mergegit merge branchname


Source: sureshtechlabs.com


Share this post:

WhatsApp Facebook Twitter Telegram