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 remote — Connecting to a Remote

0m 00s

Sharing Your Work

A remote is another copy of the repository — usually on GitHub, GitLab, or a server. You can have multiple remotes, but the main one is almost always called origin.

git remote add origin https://github.com/user/repo.git
git remote -v            # list remotes with their URLs
git remote rename origin backup
git remote remove backup

Remote URL formats

# HTTPS (password / token)
https://github.com/user/repo.git

# SSH (key-based, no password prompts)
git@github.com:user/repo.git

Bare repositories

A bare repo (git init --bare) has no working directory — it only stores the Git history. This is what GitHub stores on their servers.

Your Task

Two directories have been created: remote.git (a bare repo acting as "GitHub") and local (your working repo). Add remote.git as the remote named origin to the local repo.

Back
bashCtrl+Enter to run
Output

Click "Run" to execute your code.