Advanced 10 terms

Git — Advanced Operations

Master advanced Git commands used in professional engineering workflows: interactive rebase, cherry-pick, reflog, bisect, stash, worktree, and sparse-checkout.

  • Interactive rebase /ɪnˈtærəktɪv ˈriːbeɪs/

    A rebase mode that opens an editor to let you reorder, combine, edit, or drop commits. Used to clean up commit history before merging a feature branch.

    "Before merging, run git rebase -i HEAD~5 to squash the five WIP commits into one clean commit with a descriptive message."
  • squash (rebase) /skwɒʃ/

    A rebase pick option that combines a commit with the previous commit, merging their changes into one.

    "Mark all the fixup commits as squash in the interactive rebase — the resulting single commit will include all changes and let you write one clear message."
  • git cherry-pick /ɡɪt ˈtʃeri pɪk/

    Apply the changes from a specific commit onto the current branch, without merging the entire branch.

    "We cherry-picked the hotfix commit from the release branch onto main to get the fix into production without merging unfinished features."
  • git reflog /ɡɪt ˈrefˌlɒɡ/

    A log of everywhere HEAD has pointed, including commits that are no longer referenced. Used to recover lost commits or undo accidental resets.

    "After the accidental reset, I used git reflog to find the commit SHA and ran git checkout to recover the lost work."
  • git bisect /ɡɪt ˈbaɪsekt/

    A binary search tool for finding the commit that introduced a bug. You mark commits as good or bad and Git narrows down to the culprit.

    "git bisect identified the regression in 7 steps across 200 commits — we marked HEAD as bad and the last release as good, then bisect found the exact commit that broke the sorting algorithm."
  • git stash /ɡɪt stæʃ/

    Temporarily shelve uncommitted changes so you can switch branches or tasks, then restore them later with git stash pop or git stash apply.

    "I stashed my in-progress changes with git stash push -m "auth refactor WIP", switched to fix an urgent bug, then restored with git stash pop."
  • git worktree /ɡɪt ˈwɜːktriː/

    A linked working directory from one repository that allows you to have multiple branches checked out simultaneously in different directories.

    "Using git worktree add ../hotfix-1.8 release-1.8 let me work on the hotfix in a separate directory without stashing my main feature branch work."
  • git rerere /ɡɪt rɪˈrɪərɪ/

    Reuse Recorded Resolution — Git remembers how you resolved a merge conflict and automatically applies the same resolution next time.

    "With rerere enabled, rebasing the long-running feature branch onto main was quick — Git automatically resolved the recurring i18n conflicts using the saved resolution."
  • --no-commit (cherry-pick) /nəʊ kəˈmɪt/

    A cherry-pick flag that applies the commit's changes to the working tree and index but does not create a commit, allowing further edits before committing.

    "I cherry-picked the migration script with --no-commit to modify the target table name before committing the adjusted version."
  • Sparse checkout /spɑːs ˈtʃekˌaʊt/

    A Git feature that allows checking out only a subset of the files in a repository, useful for large monorepos where you only need specific directories.

    "In the 40 GB monorepo, sparse checkout with cone mode lets frontend developers only check out the packages/ui/ directory, reducing clone time from 18 minutes to 2 minutes."

Ready to practice?

Test your knowledge of these terms in the interactive exercise.

Start exercise →