Home - ivomac/GitBasics GitHub Wiki

πŸͺ£ Git Concepts Explained Visually

  • πŸ—οΈ Git's power comes with complexity that can be intimidating.
  • ⁉️ Many Git concepts are counter-intuitive or confusingly named:
    • Cherry-pick? Detached HEAD??
  • πŸ”Ž We explore some elements of git from different perspectives to create a more solid picture.
  • πŸ₯Έ The objective is to understand git better, not to know all the internals.
  • 🧰 We barely discuss terminal commands. We focus on what can be done and why.
  • 🍼 Streamlined for internet-age kids with no attention span!

⚠️ Usage

  • πŸ›  Previous experience with Git and programming is expected.
  • 🌲 This emoji indicates SourceTree-specific info.

🧱 Content

πŸͺ£ Git Repository as a Graph

  • πŸ“Έ Commits: Nodes in a graph
  • πŸ‘‰ Branches: Simple pointers to commits
  • 🧭 HEAD: The reference to the current commit
  • πŸ“‹ Index: The draft of the next commit

πŸ“ Git Repository Folder

  • πŸ“‹ Staging: Preparing the next commit
  • βœ… Committing: Creating new nodes in the commit graph

πŸ‹οΈ Working Directory

  • πŸ“‚ Project Dir: File structure
  • 🚫 File States: Staged/Unstaged, tracked/untracked, ignored

πŸ”€ Checkout/Switching

  • πŸ”€ Moving Around: Switch to/Checkout commits/branches
  • πŸ“¦ Stashing: Temporarily storing uncommitted changes
  • 🌳 Worktrees: Work on multiple branches in separate folders

πŸ” Diffs

  • 🧩 Hunks: Segments of changes
  • πŸ” Diffs: Comparing versions
  • πŸ”ƒ Conflict Markers: The way Git shows several versions in a file
  • πŸ“ Commit Distance: Common measure to compare branches

πŸ”„ Merging

  • πŸ”„ Merging: Combining work from different branches
  • βš”οΈ Resolving Conflicts: Strategies and best practices

✏️ Rebasing

  • πŸ’ Cherry-picking: Applying specific commits to different branches
  • ✏️ Rebasing: Move an entire branch to a different base commit
  • πŸ”§ Interactive Rebasing: Squashing, editing, and reordering commits

πŸš‘ Recovery Techniques

  • πŸ•ΈοΈ Reflog: A safety net for recovering lost commits
  • βͺ Reset/Revert/Restore: Different ways to undo changes

🌐 Remotes

  • 🌐 Remotes: The repositories you want to sync with
  • πŸ”— Tracking: How local and remote branches relate
  • πŸ”„ Syncing: Syncing with other repositories
  • πŸ‘₯ Merge/Pull Requests: Online collaboration feature

βš™οΈ Configuration

  • πŸ› οΈ Git Config: User identity, line endings, default branch, rerere...
  • πŸͺ Git Hooks: Automating tasks with pre-commit and post-commit hooks

πŸͺŸ Interfaces

  • πŸ“Ί git: Git's main interface (the git CLI)
  • πŸš€ lazygit: Fully-featured and intuitive TUI
  • 🌲 SourceTree: Popular free cross-platform GUI