Skip to content

Git Workflow with Linear Integration

Jordan Janakievski edited this page Oct 30, 2023 · 6 revisions

Git Workflow with Linear Integration

Introduction

This document outlines a Git workflow that integrates with Linear, a ticket tracking system. This workflow helps maintain consistency in branch naming, commit messages, and pull request (PR) descriptions, making it easier to link Git changes with Linear issues.

Branching

  1. Branch Naming:
  • Obtain the branch name from the Linear issue by copying it.
image
  • Create a new Git branch using the copied name.
git checkout -b <branch-name>

Commits

  1. Commit Messages:
  • Use a standard format for commit messages, including the Linear issue identifier (e.g., TCES-1) and a concise description.
  • Using magic words from the Pull Request section will link the commit to a Linear issue
git commit -m "Completing TCES-1 Added new files to the repository"

Branch Management

  1. Protected Branch:
  • Consider marking the main branch as a protected branch to prevent direct pushes.
  1. Example Branches:
  • Create and work on feature branches (e.g., tces-123-user-api and tces-321-profile-ui) for new features or bug fixes.
  • To keep your feature branch up to date with the latest changes in main, periodically merge main into your feature branch:
git checkout <feature-branch>
git merge main

Pull Requests

See the README on how to access the Docker terminals

  1. Run the linter in the necessary directory or directories to check for any errors
npm run lint
  1. Run the formatter in the event of any failed lints for the necessary directory or directories
npm run format
  1. Pull Request Naming:
  • Name your PRs to match your branch names. This makes it easier to link PRs with Linear issues.
  1. PR Description:
  • Use "magic words" in the PR description to link it with Linear issues. Examples:
    • Fixes TCES-1: This automatically closes the issue when the PR is merged.
    • Here is a list of all magic words: close, closes, closed, closing, fix, fixes, fixed, fixing, resolve, resolves, resolved, resolving, complete, completes, completed, completing

If you have any other questions, please feel free to check out the GitHub Documentation for Linear