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 merge — Combining Branches

0m 00s

Bringing Work Together

After finishing work on a branch, you merge it back into main:

git switch main          # go back to main
git merge feature        # bring feature's commits into main

Fast-forward merge

When main hasn't changed since branching, Git simply moves the main pointer forward — no merge commit needed:

Before:  main → A
         feature → A → B → C

After:   main → A → B → C
         feature → A → B → C

Three-way merge

When both branches have diverged, Git creates a new merge commit that combines both histories:

Before:  main → A → B
         feature → A → C

After:   main → A → B → M  (merge commit, M has two parents: B and C)
         feature → A → C

Your Task

The feature branch already has a commit. Switch to main and merge feature into it.

Back
bashCtrl+Enter to run
Output

Click "Run" to execute your code.