Skip to content

Instantly share code, notes, and snippets.

View vdye's full-sized avatar

Victoria Dye vdye

  • GitHub
View GitHub Profile
@vdye
vdye / debugging-git.md
Created June 8, 2022 17:07
Debugging Git in Mac & Linux

With printouts

Use printf or warn to print out messages to the terminal.

Use trace2_printf to print messages to trace2 logs, which are displayed in the terminal by running the git exe with GIT_TRACE2_PERF=1.

lldb (Mac)

The lldb utility is a debugger for C/C++ programs compiled using clang (the default compiler for MacOS). It can be run via the command line or (in many cases) used with your IDE of choice (the example below uses VSCode).

@vdye
vdye / aliases.gitconfig
Last active March 14, 2023 12:55
Custom `git` aliases
[alias]
# Deletes any branches that have been merged into `main`, cleaning up the list in `git branch`
cleanup-branches = "!sh -c 'for branch in $(git for-each-ref --format \"%(refname:short)\" refs/heads); do git branch -d $branch; done'"
# Finds the first commit matching the given commit (arg 1)'s message on a specified branch (arg 2, otherwise HEAD)
find-commit = "!sh -c 'git log -1 --grep=\"^$(git show -s --pretty=format:%s $1 | sed \"s/[.[\\*^$()+?{|]/\\\\\\&/g\")\" $2' -"