DeveloperBreeze

Git Programming Tutorials, Guides & Best Practices

Explore 4+ expertly crafted git tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Tutorial
bash

Mastering Advanced Git Workflows for Professional Developers

Extract a subdirectory into its own repository:

git filter-repo --path path/to/subdir

Dec 10, 2024
Read More
Tutorial
bash

How to Undo Your Last Commit Without Changing Your Working Directory

No preview available for this content.

Nov 14, 2024
Read More
Tutorial

Mastering GitHub Workflows for Continuous Integration and Deployment

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Deploy to server
      env:
        SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
      run: |
        ssh-agent bash -c 'ssh-add <(echo "$SSH_PRIVATE_KEY") && ssh -o StrictHostKeyChecking=no user@server "cd /path/to/app && git pull && npm install && pm2 restart all"'
  • on: push: Triggers the workflow when there’s a push to the main branch.
  • secrets.SSH_PRIVATE_KEY: Retrieves the SSH key stored in GitHub Secrets, ensuring secure deployment.

Aug 29, 2024
Read More
Cheatsheet
bash

Advanced Git Techniques Cheatsheet: Rebase, Cherry-Pick, and Interactive Staging

Rebasing is a way to integrate changes from one branch into another. Unlike merge, which creates a new commit to combine the histories of the two branches, rebase moves or combines a sequence of commits to a new base commit. This can help keep your commit history linear and more readable.

# Rebase the current branch onto another branch
git rebase <branch>

# Rebase interactively, allowing you to squash, reword, or drop commits
git rebase -i <branch>

# Continue rebase after resolving conflicts
git rebase --continue

# Skip the current commit during a rebase
git rebase --skip

# Abort a rebase and return to the original branch state
git rebase --abort

Aug 20, 2024
Read More