Skip to main content

Git

Introduction

  • Git Tutorial β€’ 6 video playlist β€’ Ben Kadel πŸ“Ί
  • Git Tutorials β€’ 7 video playlist explaining git basics on a whiteboard β€’ GitKraken πŸ“Ί

General

Undoing mistakes

Branching & Merging

Searching Git History

  • git log
  • cli approach
    • search entire git history for any text with git log -S <string>
      • Search all of Git history for a string - Stack Overflow
      • works by searching all diffs that add or remove an instance of that string (i.e. that changed how many references to that string there were)
        • use -G instead of -S to simply find all diff lines that match the regexp (regardless of whether the number of instances in the file changed)
      • gives a list of commits with diffs that contain the search string
      • add -p to the command to see the diffs too in a less pager you can search with / or page through with ctrl-f/b
    • is there a way to configure git to send the output of git log -S <search string> to vim (the way I do with kitty’s scrollback buffer / command output)?
      • or, can I at least cat everything instead of paging it with less so that I can then send the kitty output to nvim my usual way?
  • lazygit
  • vs code / GitLens
  • vim fugitive
  • Git log customization β€’ Justin Joyce πŸ“–
    • improve my git log output in Lazygit?
    • improve my git log output in CLI?

Searching current codebase

Committing

Diffing

  • Git Diff β€’ Basic CLI output using --stat to see just the list of changed files with their changed line counts β€’ Justin Joyce πŸ“–
  • quick way to diff two text blocks? e.g. was just on a call where a few lines were thought to be the same (and could be extracted), but that was determined just by eyeballing β€” what would be a better alternative to prove whether the text is actually the same?

Forking

Configuration

  • Popular git config options β€’ Julia Evans πŸ“–
  • Better git diff with delta β€’ Pawel Grzybek πŸ“–
  • Sorting Git branches β€’ Cassidy Williams πŸ“–
  • is a global ignore file a bad practice when collaborating? would it be better not to have it so I/we am/are prompted to ignore those files at the project level?
    • prompted by a project that included (didn’t ignore) some source files in a dist/ directory
    • after using one for awhile, I think it’s actually not great when working on shared projects

Git worktrees

Other concepts

Inbox