Skip to content

A comprehensive, step-by-step guide to mastering Git and GitHub. Covers everything from initial setup and basic workflows to advanced branching strategies, rebase operations, and deep dives into Git internals.

Notifications You must be signed in to change notification settings

dmitrykitty/git_with_me

Repository files navigation

Git Cheatsheet - A Quick Reference

Welcome to my repository! This is a collection of the most important and frequently used Git commands that I've compiled for myself and others.

Everything here is based on the excellent Learn Git course from boot.dev.


Topics

  • Installing Git on Mac/Windows/Linux;
  • Configuring user name and email;
  • Initializing a repo with git init;
  • The 3-stage workflow (Working, Staging, Repo);
  • Checking status with git status;
  • Staging files with git add;
  • Committing changes with git commit;
  • Viewing history with git log;
  • How Git stores data: blobs (content) & trees (filenames);
  • What a commit object is (a snapshot + parent link);
  • Peeking inside the .git directory;
  • Using git cat-file to inspect raw objects;
  • How Git's snapshot model saves space (deduplication);
  • Config scopes: --global vs --local;
  • Viewing settings with git config --list;
  • Adding, getting, and deleting configuration keys;
  • The Hierarchy: How local settings override global ones;
  • What is a branch? (A lightweight movable pointer);
  • Creating and switching branches with git switch;
  • Renaming master to main;
  • Understanding HEAD and detached states;
  • Viewing decorations in git log;
  • Combining diverged history with git merge;
  • Understanding Merge Commits (two parents);
  • Fast-Forward merges (linear history);
  • Handling the default editor (Vim) during merges;
  • Rewriting history to move a branch base;
  • How git rebase works internally (replay commits);
  • The philosophy: Merge ("The Documentary") vs. Rebase ("The Storybook");
  • The Golden Rule: Never rebase public branches;
  • Undoing changes with git reset;
  • --soft: Undo the commit, keep the work staged;
  • --hard: Delete the commit and the work (destructive);
  • Recovering "lost" commits using git reflog;
  • Understanding remotes (just another folder);
  • origin vs upstream;
  • Adding a remote with git remote add;
  • The difference between git fetch (download) and git merge (update);
  • Git vs. GitHub (Tool vs. Service);
  • HTTPS vs. SSH keys;
  • Pushing code with git push and setting upstream (-u);
  • Pulling strategies (pull.rebase false);
  • The Professional Workflow: Branch -> Push -> Pull Request -> Merge;

About

A comprehensive, step-by-step guide to mastering Git and GitHub. Covers everything from initial setup and basic workflows to advanced branching strategies, rebase operations, and deep dives into Git internals.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published