Skip to content

GitHub, GitLab, and Bitbucket

Git is a distributed version control system. GitHub, GitLab, and Bitbucket are platforms built around Git that add collaboration features: pull/merge requests, CI/CD pipelines, issue tracking, code review, and project management. This guide covers the platform-specific features, CLIs, and CI/CD configuration for each.


Platform Comparison

Feature GitHub GitLab Bitbucket
Code Review Pull Requests Merge Requests Pull Requests
CI/CD GitHub Actions GitLab CI/CD Bitbucket Pipelines
CI Config .github/workflows/*.yml .gitlab-ci.yml bitbucket-pipelines.yml
CLI gh glab None (official)
Container Registry GitHub Packages Built-in None (use Docker Hub)
Issue Tracking Issues + Projects Issues + Boards + Epics Issues + Jira integration
Self-Hosted GitHub Enterprise GitLab CE/EE (free self-host) Bitbucket Data Center
Free Private Repos Unlimited Unlimited Unlimited (5 users)
Unique Features Copilot, Codespaces, Discussions, Sponsors Built-in DevSecOps, DORA metrics, Value Stream Jira/Confluence integration

GitHub

The gh CLI

gh is GitHub's official CLI. It handles pull requests, issues, releases, actions, and more without leaving the terminal.

# Install
brew install gh          # macOS
sudo apt install gh      # Debian/Ubuntu
winget install GitHub.cli  # Windows

# Authenticate
gh auth login

Pull Request Operations

# Create a PR
gh pr create --title "Add user search" --body "Implements search with elasticsearch"

# Create a draft PR
gh pr create --draft --title "WIP: Add user search"

# List open PRs
gh pr list

# View PR details
gh pr view 42

# Check out a PR locally
gh pr checkout 42

# Review a PR
gh pr review 42 --approve
gh pr review 42 --request-changes --body "Need tests for edge cases"

# Merge a PR
gh pr merge 42 --squash --delete-branch

Issue Operations

# Create an issue
gh issue create --title "Search results missing pagination" --label "bug"

# List issues
gh issue list --label "bug"

# Close an issue
gh issue close 15

Other Operations

# View repository
gh repo view

# Create a release
gh release create v1.0.0 --title "Version 1.0.0" --notes "First stable release"

# View Actions workflow runs
gh run list
gh run view 12345

# Clone a repo
gh repo clone user/repo

GitHub Actions

GitHub Actions is GitHub's CI/CD platform. Workflows are YAML files in .github/workflows/:

Code Owners

.github/CODEOWNERS assigns reviewers automatically based on file paths:

# These owners are requested for review when someone opens a PR
# that modifies files matching the pattern

*.py        @backend-team
*.js *.ts   @frontend-team
/docs/      @tech-writers
/infra/     @devops-team @security-team

GitLab

The glab CLI

glab is GitLab's official CLI, modeled after gh:

# Install
brew install glab       # macOS
sudo apt install glab   # Debian/Ubuntu

# Authenticate
glab auth login

Merge Request Operations

# Create an MR
glab mr create --title "Add user search" --description "Elasticsearch integration"

# List open MRs
glab mr list

# View an MR
glab mr view 42

# Approve an MR
glab mr approve 42

# Merge an MR
glab mr merge 42 --squash

GitLab CI/CD

GitLab CI/CD is configured with .gitlab-ci.yml in the repository root:

GitLab-Specific Features

  • Epics - group related issues across projects
  • Merge trains - queue MRs for sequential merging with CI verification
  • DORA metrics - built-in DevOps performance tracking
  • Environments - track deployments with rollback support
  • Protected environments - require approval before deployment

Bitbucket

Bitbucket focuses on Atlassian ecosystem integration - tight coupling with Jira and Confluence.

Bitbucket Pipelines

CI/CD is configured with bitbucket-pipelines.yml:

image: python:3.12

pipelines:
  default:
    - step:
        name: Test
        caches:
          - pip
        script:
          - pip install -r requirements.txt
          - pytest --verbose

  branches:
    main:
      - step:
          name: Test
          script:
            - pip install -r requirements.txt
            - pytest
      - step:
          name: Deploy
          deployment: production
          script:
            - echo "Deploying to production"
          trigger: manual

  pull-requests:
    '**':
      - step:
          name: Test PR
          script:
            - pip install -r requirements.txt
            - pytest --verbose

Bitbucket-Specific Features

  • Jira integration - commits and PRs link to Jira issues automatically (include the issue key like PROJ-123 in branch names or commit messages)
  • Deployment permissions - require Jira approval before deploying
  • Pipes - pre-built CI/CD integrations (similar to GitHub Actions marketplace)
  • Merge checks - enforce minimum approvals, passing builds, and resolved tasks

Platform Feature Mapping


Setting Up CI for Each Platform


Migrating Between Platforms

Since all three platforms use standard Git, migration is straightforward:

# Clone from the old platform
git clone --mirror git@old-platform.com:user/repo.git
cd repo.git

# Push to the new platform (create the empty repo there first)
git push --mirror git@new-platform.com:user/repo.git

--mirror copies all refs (branches, tags), all objects, and the complete history. You'll need to recreate platform-specific configuration (CI files, webhooks, branch protection) manually.

Things that don't migrate automatically:

  • Pull requests / merge requests and their comments
  • Issues and project boards
  • CI/CD configuration (different YAML formats)
  • Webhooks and integrations
  • Wiki content (if using platform wikis)

Some tools help migrate issues and PRs (GitHub Importer, GitLab import), but review is needed to ensure nothing is lost.


Further Reading


Previous: Collaboration Workflows | Next: Git Hooks and Automation | Back to Index

Comments