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
- How to branch off of a feature branch (while you wait for the feature branch to be merged):
- Resolving a merge conflict:
- The EXTREMELY helpful guide to merge conflicts β’ Starts with a great explanation (with visuals) of what a merge conflict actually is, followed by a walkthrough of how to use a 3-way merge editor to resolve one β’ Visual Studio Code πΊ
- Lazygit if simple enough to chose one side or the other
- VS Code if more complex? Neovim?
- Reverting a merge:
- Deleting merged branches:
- Wait, what does a BRANCH do again? β’ A branch is a pointer to a single commit; itβs not a collection of related commits β’ GitKraken πΊ
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
- use via Lazygit?
- use via VS Code?
- use via neovim?
Other concepts
Inbox