Git & GitHub: Branching Strategies, Conflict Resolution, SSH Keys, and Actions CI/CD
A developer playbook for professional version control and automation. Learn how to manage trunk-based branches, resolve rebase conflicts, configure secure SSH keys, and write YAML pipelines.
In software engineering, version control is the baseline of team collaboration. Mastering Git CLI, understanding branching topologies, and automating deployment loops using GitHub workflows are mandatory requirements for any professional developer.
1. Collaborative Branching Strategies
Three main branching styles dominate production engineering:
- Git Flow: Employs multiple stable branches (
main,develop,release/*,feature/*,hotfix/*). Great for scheduled releases. - GitHub Flow: Uses light, short-lived branch structures (
main,feature/*). Feature branches are merged intomainafter pull request reviews. - Trunk-Based Development: Developers merge small, frequent updates directly into the single trunk (
main), using feature flags to disable untested code paths.
Trunk-based:
──[main]─────●──────────●──────────●───
\ / /
└[feat]┘ └[feat2]┘
2. Resolving Git Merge and Rebase Conflicts
Rebasing updates your branch with target commits by placing your active commits on top of the branch tip:
git checkout feature/api
git rebase main
If a conflict occurs:
- Git halts and reports conflicting lines.
- Open files and choose between head changes (
<<<<<<<) and incoming changes (>>>>>>>). - Save edits, add files, and continue the rebase:
git add file.js
git rebase --continue
3. Configuring SSH Keys for GitHub Access
SSH offers passwordless, secure access keys. To generate an SSH key using the Ed25519 algorithm:
ssh-keygen -t ed25519 -C "your_email@example.com"
Start the ssh-agent and load your key:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
Copy the public key content and add it inside your GitHub Account Settings:
cat ~/.ssh/id_ed25519.pub
4. Automated CI/CD Pipelines via GitHub Actions
GitHub Actions run automated workloads triggered by branch updates. Workflows are defined inside .github/workflows/ using YAML configuration:
# .github/workflows/ci.yml
name: Continuous Integration
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Setup NodeJS Environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run Test Suite
run: npm run test
- name: Verify Bundle Compilation
run: npm run build
This workflow runs quality checks automatically on every pull request, safeguarding your main branch from compiler errors.
Related Articles
The Open-Source Playbook: Pull Requests, Licensing, and Collaborative Code Reviews
A comprehensive developer's guide to contributing to open-source software. Learn pull request workflows, understand licensing options, and master code review etiquette.
Read Article →AWS VPC Security Hardening: Network Isolation & IAM Best Practices
A production-grade playbook for isolating AWS cloud resources, designing subnets, configuring NACLs/Security Groups, and enforcing least privilege IAM controls.
Read Article →Kubernetes CI/CD: Optimizing GitHub Actions and Container Security Scanning
A comprehensive guide on building secure Docker containers, scanning for image vulnerabilities, and deploying automatically to Kubernetes clusters using GitHub Actions.
Read Article →Continue Reading
Node.js & Express.js: Event Loop, Middleware Routing, and Cluster Scaling
A comprehensive guide to building high-throughput backends with Node.js. Learn about the Libuv event loop, writing custom Express middleware, and scaling with cluster processes.
Read Article →The Open-Source Playbook: Pull Requests, Licensing, and Collaborative Code Reviews
A comprehensive developer's guide to contributing to open-source software. Learn pull request workflows, understand licensing options, and master code review etiquette.
Read Article →OS & Networking: CPU Scheduling, Virtual Memory, and the TCP/IP Stack
A developer's guide to system internals and computer networks. Learn CPU scheduling algorithms, virtual memory paging, socket operations, and TCP/IP routing structures.
Read Article →Prerequisites
The Comprehensive DevOps Roadmap: Containerization to Declarative Cloud Pipelines
A production-grade playbook for DevOps. Master Docker containerization, Kubernetes clusters, Terraform IaC, GitHub Actions, Linux administration, and Nginx configurations.
Read Article →Popular Articles
The Complete C Programming Roadmap: From Syntax to Memory Control
A comprehensive deep-dive into C programming, memory optimization, dynamic memory allocation, pointers, data structures, and production-grade coding standards.
Read Article →The Complete C++ Journey: From OOP Fundamentals to Modern Architectures
A comprehensive developer's guide to C++ programming. Deep-dive into class designs, move semantics, template metaprogramming, STL, smart pointers, multithreading, and concurrency.
Read Article →Database Architectures: Indexing Keys, MongoDB Design, Sharding, and Redis Caching
A production-grade playbook for selecting, designing, and scaling databases. Deep-dive into B-Tree indexes, NoSQL document modeling, cluster sharding, and cache eviction patterns.
Read Article →Recent Articles
The Complete C Programming Roadmap: From Syntax to Memory Control
A comprehensive deep-dive into C programming, memory optimization, dynamic memory allocation, pointers, data structures, and production-grade coding standards.
Read Article →The Complete C++ Journey: From OOP Fundamentals to Modern Architectures
A comprehensive developer's guide to C++ programming. Deep-dive into class designs, move semantics, template metaprogramming, STL, smart pointers, multithreading, and concurrency.
Read Article →Database Architectures: Indexing Keys, MongoDB Design, Sharding, and Redis Caching
A production-grade playbook for selecting, designing, and scaling databases. Deep-dive into B-Tree indexes, NoSQL document modeling, cluster sharding, and cache eviction patterns.
Read Article →