Skip to content

Feature Branch Workflow in Git

Feature Branch Workflow

This popular git workflow involves creating new branches for every new feature or fixes directly in the main repository. It’s usually employed in projects where contributors have direct push access to the repository.

This Gemstone outlines the process of setting up a local repository to work on and contribute to the rocky-linux/documentation project using the Git Feature Branch Workflow.

The user "rockstar" has forked this repository, and we will use as the origin.


  • A GitHub account and a fork of the project (e.g.,
  • git and GitHub CLI (gh) installed.


  1. If not already done, clone your fork:
git clone
cd documentation
  1. Add the upstream remote:
git remote add upstream
  1. Fetch Upstream changes:
git fetch upstream
  1. Create a New Feature Branch:
git checkout -b feature-branch-name
  1. Make changes, add new files, and commit them:

    git add .
    git commit -m "Implementing feature X"
  2. Keep Your Branch Updated. Regularly merge changes from upstream to avoid conflicts:

    git pull upstream main --rebase
  3. Push to your fork, type:

git push origin feature-branch-name
  1. Create a Pull Request:
gh pr create --base main --head rockstar:feature-branch-name --title "New Feature X" --body "Long Description of the feature"


The Feature Branch workflow is a common collaboration technique, allowing teams to work concurrently on various aspects of a project while maintaining a stable main codebase.

The high-level steps involved are:

  1. Clone the Main Repository: Directly clone the main project repository to your local machine.
  2. Create a Feature Branch: For every new task, create a new branch of the main branch with a descriptive name.
  3. Commit Changes: Work on the feature or fix in your branch and commit changes.
  4. Keep Branch Updated: Regularly merge or rebase with the main branch to stay updated on changes.
  5. Open a Pull Request: Push the branch to the main repository and open a PR for review once your feature is ready.
  6. Code Review and Merge: The branch is merged into the main branch after review and approval.


  • Streamlines contributions for regular contributors with direct repository access.
  • Ensures each feature is reviewed before being integrated into the main codebase.
  • Helps maintain a clean and linear project history.

Author: Wale Soyinka

Contributors: Ganna Zhyrnova