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

Resolving Merge Conflicts

0m 00s

When Git Can't Decide Automatically

A conflict happens when the same lines were changed differently on two branches. Git pauses the merge and marks the conflict in the file:

<<<<<<< HEAD
This is the version on main
=======
This is the version on feature
>>>>>>> feature

Resolving a conflict — step by step

  1. Open the conflicted file and decide what it should contain
  2. Remove the conflict markers (<<<, ===, >>>)
  3. git add <file> — mark as resolved
  4. git commit — finish the merge
git merge --abort     # cancel the merge if you're stuck

Your Task

The script creates a conflict in story.txt. Resolve it so the file contains exactly The hero wins., then finish the merge commit with message "Merge feature: hero wins".

Back
bashCtrl+Enter to run
Output

Click "Run" to execute your code.