Boost Your Git DX update out now
I have just released an update to my book Boost Your Git DX, six months after its initial release. This update adds some extra content and has a bunch of edits based on reader feedback. The PDF is now ten pages longer, for a total of 363.
Boost Your Git DX covers ways to improve your development experience (DX) with Git on the command line. It covers the best tools, techniques, tips, tricks, and tactical tidbits that I’ve encountered in 11.5 years of using Git. See below for some sample blog posts and the full table of contents.
This update is free for all who previously purchased the book, and I’m sending an email to notify readers. There’s a changelog in the first chapter with links to the changed sections, reproduced below.
This update coincides with Gumroad’s 13th birthday, where they’re cutting their fee. I’m passing this saving on to you, so the book is discounted 10% for today only, from $39 to $35.10. On top of this, the headline price is automatically discounted up to 60% to match local purchasing power in your country. There’s also a bundle deal with my Django DX book, and team licenses are available.
May you always Git better,
—Adam
Praise
The book has sold ~750 copies since its release last October. It has a five-star rating and many positive reviews listed on Gumroad, such as:
"This book is simply amazing, from page 1 the content in invaluable with tips and tricks that will make any dev more productive. Thank you Adam for the great book. "
“This book transformed my day-to-day operations. As a self-taught engineer, I have found myself starved for mentorship, and Boost Your Git DX has been my most influential mentor in 2023.”
“Adam's written two books before (Boost Your Django DX; Speed Up Your Django Tests) — both paid for themselves within the first hour of my purchase. This one's a no-brainer, too.”
Free samples
I’ve written 44 blog posts on Git, many of which are included in the book. Here’s a selection:
Changelog
- Added git log section “Collapse merge commits with
--first-parent
”. - Added “Command commonalities” section “Condense output with
column.ui=auto
”. - Added
git blame
section “Ignore code copying with-C
(-C -C
)”. - Added ripgrep section “Hyperlink file paths with
--hyperlink-format
” and added--hyperlink-format default
to the sample configuration file. - Moved the section on
git switch -
(switch to previous branch) into a general commit reference section. - Added subsections to the section on Git aliases for shell commands covering multiline aliases and forcing autocomplete.
- Expanded the
git log
section “Filter by commit message content with--grep
” to cover--invert-grep
. - Expanded the
git merge
section “Enable rerere to reuse recorded (conflict) resolutions“ to coverrerere.autoUpdate
. - Expanded the
git push
section “Force push safely with--force-with-lease
and--force-if-includes
” to cover howgit push -f
may still be needed sometimes. - Made many smaller edits. Thanks to all readers who suggested improvements.
Table of contents
- Introduction
- About this book
- Read in any order
- Example commands and resources
- End-of-chapter feedback links
- Acknowledgements
- Changelog
- About this book
- Global configuration
- Git’s configuration files
- Store global configuration in
~/.config/git
- Migrate from legacy
~/.gitconfig
to~/.config/git/config
- Read and change options with
git config
- Trace options with
git config --show-scope
and--show-origin
- Store global configuration in
- Basic configuration
- Set your name and email address
- Use a different email address based on the working directory
- Use your favourite editor
- Set up a global ignore file
- Improve the default colourization with
color.*
options - Enable
help.autoCorrect
to fix mistyped commands
- Back up your configuration
- Set up your dotfiles repository
- Save ongoing configuration changes
- Track other configuration files
- Restore your backup
- Git’s configuration files
- Aliases
- Shell aliases
- Create shell aliases with
alias <name>=<command>
- List aliases with
alias
- Bypass aliases with
\
- Create shell aliases with
- Git aliases
- Create an alias that runs a single Git command
- Create an alias that runs shell commands
- Add a
git git
alias to help when you lose attention
- Shell aliases
- Shell configuration
- oh-my-zsh: instant enhancements and aliases
- Install oh-my-zsh
- Some handy Git aliases
- Learn your aliases on the go with zsh-you-should-use
- Starship: a powerful, performant prompt
- Install Starship
- Personalize your prompt
- Read Git state at a glance with Starship’s prompt
- oh-my-zsh: instant enhancements and aliases
- Shell tools
- Less: the power pager
- Activate lesser-known features with the
LESS
environment variable - Scroll and search with keyboard shortcuts
- Search forwards with
/
and backwards with?
- Use Less with more Git commands
- Activate lesser-known features with the
- delta: dapper diff display
- Set up Git to use delta
- How delta enhances Git’s output
- Temporarily disable delta
- Run delta directly as a diff tool
- ripgrep: rip-roaringly rapid grep
- Install ripgrep
- Search basics
- Change case sensitivity with
-i
or-S
- Hyperlink file paths with
--hyperlink-format
- Unrestrict searches with specific options or
-u
- Filter by file extensions with
-g
or-t
- Configure ripgrep in
~/.config/ripgreprc
- Combine with delta for lovely formatting
- Less: the power pager
- Repository configuration
- Default branch naming
- Use
main
for your default branches - Alias
master
asmain
in legacy repositories
- Use
- Ignore files
- The basics of ignore files
- Ignore file tips
- Commands for debugging ignore files
- Default branch naming
- Hooks and the pre-commit framework
- Git hooks
- pre-commit: Universal Hook Manager
- Install pre-commit
- Configure pre-commit
- Update hooks with
pre-commit autoupdate
- Extra protection from pre-commit-hooks
- ripsecrets: Protect your secrets
- Find more hooks
- Skip hooks temporarily with
--no-verify
orSKIP
- oh-my-zsh plugin
- pre-commit ci: continuous integration for your hooks
- Command commonalities
- Common options
- Get short or long help with
-h
or--help
- Condense output with
column.ui=auto
- Override configuration with
-c
- Use repositories in other directories with
-C
- Get short or long help with
- Commit SHAs
- SHA abbreviation
- Show and copy the current commit SHA
- SHA-1 versus SHA-256
- Commit references
- Single commit references
- Commit range references
- Date specifications
- Top formats
- Pathspecs
- Top pathspec syntaxes
- Using pathspecs
- Common options
- Branches and
worktree
- Switching branches
- Use
git switch
instead ofgit checkout
- Top
git switch
commands
- Use
- Listing branches
- Basic branch listing commands
- Sort by recency and switch with fzf (fuzzy finder)
- Find branches missing a given commit
- Deleting old branches
- Configure your Git host to delete merged branches
- Enable automatic pruning of remote branches
- Add an alias to delete local branches
worktree
worktree
basics- Using a worktree to write a hotfix
- Switching branches
status
anddiff
status
- Enable denser output with
--short
orstatus.short
- Shorten long format by disabling advice with
advice.statusHints
- Hide untracked files with
-uno
- List changed files with
git diff --name-only
- Enable denser output with
diff
- Improve diff generation with
diff.algorithm=histogram
- See more context with
diff.interHunkContext
- Enable language-specific hunk headings
- Use ExifTool to diff media files
- Use Pandoc to diff document files
- Make file paths complete with
diff.noprefix
- Improve diff generation with
add
andrestore
add
(andmv
andrm
)- The three commands:
add
,mv
, andrm
- Add interactively with
git add -p
- Add all changes with
git add -u
or-A
- The three commands:
restore
- Use
git restore
instead ofcheckout
andreset
- Top
git restore
commands - Restore interactively with
-p
- Use
commit
andreset
commit
- Improve commit message editing with verbose mode and “scissors” cleanup
- Use
-m
to set the message without your editor - Use
-a
or an alias to add all files and commit - Declare coauthors in
co-authored-by
trailers - Update the previous commit with
--amend
- Create empty commits with
--allow-empty
reset
- Undo commits and keep their changes with
--mixed
or--soft
- Undo commits and discard their changes with
--keep
(not--hard
) - Useful commit references for resetting
- Undo commits and keep their changes with
stash
andapply
stash
stash
basics- Push stash entries with a description with
-m
- Stash selected files by pathspec
- Stash only unstaged changes with
-k
or staged changes with-S
- Stash selected hunks interactively with
-p
- Automatically stash during merge and rebase with the autostash options
apply
apply
basics- Send and receive patches by copy and paste
apply
outside of a Git repository
push
andpull
push
- Automatically create upstream branches with
push.autoSetupRemote
- Force push safely with
--force-with-lease
and--force-if-includes
- Push a commit and its annotated tags with
--follow-tags
- Automatically create upstream branches with
pull
- Rebase divergent branches when you pull with
pull.rebase
- Make a branch pull from and push to different remotes
- Rebase divergent branches when you pull with
merge
andrebase
merge
- Improve conflict display with the
zdiff3
style - Open all conflicted files with the
edit-unmerged
alias - Enable rerere to reuse recorded (conflict) resolutions
- Pick one side of conflicts with
git restore
orgit merge -X
- Improve conflict display with the
rebase
- Control rebasing with interactive mode (
-i
) - Top interactive mode actions
- Squash and rebase a branch with
--keep-base
- Rebase stacked branches with
--update-refs
- Run a command at each step with
-x
- Automatically fix up commits with
rebase.autoSquash
- Drop already-merged commits with
--empty drop
- Control rebasing with interactive mode (
log
andreflog
log
- Three levels of detail:
--oneline
,--stat
, and--patch
- Reveal branching structure with
--graph
- Collapse merge commits with
--first-parent
- Filter by changes with the pickaxe options
-S
and-G
- Filter by commit message content with
--grep
- Restrict time with
--since
and--until
- Sort oldest first with
--reverse
- Follow changes to a single file with
--follow
- Follow changes to a code block with
-L
- Reveal hidden changes in merge commits with
--cc
- Three levels of detail:
reflog
reflog
basics- Restore a deleted branch
- Undo a commit amendment
- Undo a rebase
blame
andbisect
blame
blame
basics- Blame a code block with
-L
- Ignore mass-change commits with
blame.ignoreRevsFile
- Ignore code copying with
-C
(-C -C
)
bisect
bisect
basics- Mark a commit as untestable with
git bisect skip
- Automate testing with
git bisect run
- Automate testing of performance regressions
- Outroduction
- Honourable mentions
- Git features
- Extra tools
- Just for fun
- Further reading
- Git updates
- Git under the hood
- Thank you
- Honourable mentions
One summary email a week, no spam, I pinky promise.
Tags: git