Skip to content

Instantly share code, notes, and snippets.

@dezman
Last active April 7, 2022 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dezman/a9ee6dd5fcabca8f4548 to your computer and use it in GitHub Desktop.
Save dezman/a9ee6dd5fcabca8f4548 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Search
git grep potato
# Local config
git config --list --show-origin
git config user.email potato
# GPG
gpg --list-keys | say
gpg --armor --export | say
git config --global commit.gpgsign true
git config user.signingkey potato
git config --global alias.logs "log --show-signature"
# A more detailed git log
git log -p
# A shorter status
git status -s
# List modified files
git ls-files -m
# Search all git branches for string or regex
git rev-list --all | xargs git grep potato
# Apply a recalcitrant git patch
git apply --reject --whitespace=fix ~/path/to.patch
# Express --intent-to-add, so you can view the diff or do other things with untracked files
git add -N .
# Stash unstaged changes
git stash -k
# Search all commit messages
git log --all --grep=potato
# Git blame some lines
git blame path/to/file.ext -L 42,+10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment