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 clone — Copying a Repository

0m 00s

Starting from an Existing Repository

git clone https://github.com/user/repo.git          # into ./repo/
git clone https://github.com/user/repo.git my-dir   # into ./my-dir/
git clone --depth 1 url                              # shallow: only latest commit

git clone does three things automatically:

  1. Creates the directory and initialises a Git repo inside
  2. Adds the source as a remote named origin
  3. Checks out the default branch

Cloning locally (same as from GitHub)

git clone /path/to/repo.git my-copy
cd my-copy
git remote -v
# origin  /path/to/repo.git  (fetch)
# origin  /path/to/repo.git  (push)

After cloning

git log --oneline          # see the history
git branch -a              # see all branches (local + remote)
git switch -c feature origin/feature  # check out a remote branch

Your Task

A bare repository exists at $BARE. Clone it into a directory called my-clone, then inside the clone make a commit and push it back.

Back
bashCtrl+Enter to run
Output

Click "Run" to execute your code.