Skip to main content

Harshal V. LADHE

Git and Version Control

Posts, tutorials, and snippets on Git — from everyday staging, committing, and branching to advanced rebasing, history rewriting, and disaster recovery workflows.

Content in Git

  • Tutorial:Share Git Commits Without a Remote: format-patch, bundle and archive

    Move Git work by email, USB stick or tarball.
    Share Git work without a remote: email commits with format-patch and am, move repos offline with git bundle, and export release files with git archive.
    Published at:
    Categories:Git
    Estimated reading time:10 min read
  • Post:Searching Git History: git log -S, -L, git grep and git blame

    Series:Git: From Basics to Advanced (3/3)
    Find when, why and by whom code changed.
    Find when code changed with git log -S and -G, trace a function with git log -L, search any commit with git grep, and blame past moves and reformats.
    Published at:
    Categories:Git
    Estimated reading time:21 min read
  • Snippet:git sync: Update Your Branch from main in One Command

    Fetch, fast-forward main, and rebase your branch onto it.
    A `git sync` command that fetches, fast-forwards `main` without a checkout, and rebases or merges your branch onto it — with autostash and undo.
    Published at:
    Categories:Git
    Estimated reading time:4 min read
  • Snippet:git prune-branches: Delete Merged and Squash-Merged Branches

    Delete merged, squash-merged and rebased local Git branches safely.
    A git prune-branches command that deletes local branches merged into main — including GitHub squash merges git branch --merged misses — with a restore command for each.
    Published at:
    Categories:Git
    Estimated reading time:5 min read
  • Snippet:Git Aliases Worth Adding to Your ~/.gitconfig

    Tested Git aliases for history, undo, fixups, and search.
    Tested Git aliases for your `~/.gitconfig`: compact logs, safe undo, one-step fixups, WIP parking, and safe force-pushes.
    Published at:
    Categories:Git
    Estimated reading time:4 min read