noknow.dev
Sign inSign up
Course overview
Git — Complete Course
0 / 24 lessons0%

Git Basics

  • git init — Starting a Repository
  • git add + git commit — Your First Commit
  • git status + git log — Reading the State
  • git diff — Seeing What Changed
  • .gitignore — Ignoring Files

Branching

  • git branch + git switch — Working with Branches
  • git merge — Combining Branches
  • Resolving Merge Conflicts
  • Cleaning Up Branches

Remote Repositories

  • git remote — Connecting to a Remote
  • git push — Uploading Your Commits
  • git fetch + git pull — Getting Remote Changes
  • git clone — Copying a Repository

Undoing Changes

  • git restore — Discarding Uncommitted Changes
  • git reset — Moving HEAD Back
  • git revert — Safely Undoing a Commit
  • git stash — Temporarily Saving Work

Rewriting History

  • git commit --amend — Fixing the Last Commit
  • git rebase — Cleaner History
  • git cherry-pick — Applying Specific Commits

Advanced Tools and Workflows

  • git tag — Marking Releases
  • Mastering git log
  • git bisect — Finding Bugs with Binary Search
  • Professional Git Workflows

git cherry-pick — Applying Specific Commits

0m 00s

Picking Only the Commits You Want

git cherry-pick applies one or more commits from another branch onto your current branch — without merging the entire branch:

git cherry-pick abc1234           # apply one commit
git cherry-pick abc1234 def5678  # apply two commits
git cherry-pick main~2..main     # apply last 2 commits from main

Common use cases

  • A critical bug was fixed on a feature branch — apply it to main immediately
  • You committed something to the wrong branch — cherry-pick it to the right one, then revert from the wrong one
  • Selectively backport fixes to older release branches
# If conflicts arise:
git cherry-pick --continue   # after resolving
git cherry-pick --abort      # cancel

Your Task

The hotfix branch has a bug fix commit. Cherry-pick just that commit onto main.

Back
bashCtrl+Enter to run
Output

Click "Run" to execute your code.