Skip to content

Instantly share code, notes, and snippets.

@withakay
Last active November 20, 2025 09:44
Show Gist options
  • Select an option

  • Save withakay/186bcc90571dffb0f0fef62c3ee6831a to your computer and use it in GitHub Desktop.

Select an option

Save withakay/186bcc90571dffb0f0fef62c3ee6831a to your computer and use it in GitHub Desktop.
My git config
[user]
name = withakay
email = [email protected]
signingkey = /Users/withakay/.ssh/id_ed25519.pub
[core]
excludesfile = ~/.gitignore_global
editor = vim
[push]
default = current
autoSetupRemote = true
followTags = true
[alias]
# List all aliases
laa = "!git config -l | grep alias | cut -c 7-"
# List all aliases with descriptions (requires 'list-aliases' script)
la = list-aliases.sh
# Shorthand for 'git add'. Adds files to the staging area.
a = add
# Adds all changes (tracked and untracked files) to the staging area.
aa = add -A
# Shorthand for 'git branch'. Shows or manages branches.
br = branch
# Shorthand for 'git checkout'. Switches between branches or restores working tree files.
co = checkout
# Shorthand for 'git commit'. Records changes to the repository.
ci = commit
# Commits all tracked changes without needing to 'git add' first.
ca = commit -a
# Commits all tracked changes without needing to 'git add' first.
cm = commit -m
# run a claude code powered script to improve generic commit messages
ic = improve-commit-message
# Shorthand for 'git status'. Shows the current state of the working directory and staging area.
st = status
# Shorthand for 'git pull'. Fetches from and integrates with another repository or branch.
pl = pull
# Pulls changes but replays your local changes on top, rather than merging.
pr = pull --rebase
# Shorthand for 'git push'. Pushes commits to the remote repository.
pu = push
# Resets the current branch to a specified state, discarding all changes.
rh = reset --hard
# Restores working directory files to their last committed state.
rs = restore --
# Displays a log of commits in a formatted view, showing commit hash, date, message, and author.
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
# Displays the type of a Git object (e.g., commit, tree, blob).
type = cat-file -t
# Shows the content of a Git object (e.g., commit, tree, blob).
dump = cat-file -p
# Displays a compact, oneline log showing the commit hash, message, and author, with a graphical representation.
l = log --graph --pretty=format':%C(yellow)%h%C(auto)%d%Creset %Creset%s %C(242)<%an>%Creset'
# Displays a compact, oneline log including relative dates (e.g., '2 days ago') along with commit details.
ll = log --graph --pretty=format':%C(yellow)%h%C(auto)%d%Creset %Creset%s %C(dim 11)(%ar) %C(246)<%an>%Creset'
# Shows a log with statistics about the changes in each commit, excluding merge commits.
ls = log --pretty=format':%C(yellow)%h%C(auto)%d%Creset %Creset%s %C(242)<%an>%Creset' --stat --no-merges
# Displays the name of the current branch.
cb = rev-parse --abbrev-ref HEAD
# Finds and displays the parent branch of the current branch.
pb = !"git show-branch -a | ack '\\*' | ack -v \"`git cb`\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//'"
# Shows the most recent tag in the current branch.
lt = describe --tags --abbrev=0
# Displays a list of filenames that have changed between commits or in the working directory.
filediff = diff --name-only
# Shows the details of the most recent commit (oneline log).
last = log -1 HEAD
# Prepares a commit to be squashed with a previous one during a rebase.
fixup = commit --fixup
# Reverts the last commit, keeping the changes in the working directory.
undo = reset HEAD~1 --mixed
# Removes files from the staging area (undoes 'git add') but leaves the changes in the working directory.
unstage = reset HEAD --
# Lists all tags in the repository.
tags = tag -l
# Lists all branches, both local and remote.
branches = branch -a
# Lists all remote repositories with their URLs.
remotes = remote -v
# Deletes all local branches that have been merged into the specified branch (default is 'main').
bclean = "!f() { git branch --merged ${1-main} | grep -v \" ${1-main}$\" | xargs -r git branch -d; }; f"
# Deletes all local branches that have been merged into the specified branch (default is 'master').
bclean-old = "!f() { git branch --merged ${1-master} | grep -v \" ${1-master}$\" | xargs -r git branch -d; }; f"
# Base shortcuts
wt = "worktree"
gwt = "wt"
wtl = "worktree list"
gwtl = "wtl"
# Remove a worktree
tr = "!f() { \
root=$(git rev-parse --show-toplevel); \
wtroot=$(dirname \"$root\")/$(basename \"$root\").worktrees; \
git worktree remove \"$wtroot/$1\"; \
}; f"
# Create a new worktree from current HEAD with new branch
wta = "!f() { \
root=$(git rev-parse --show-toplevel); \
wtroot=$(dirname \"$root\")/$(basename \"$root\").worktrees; \
git worktree add -b \"$1\" \"$wtroot/$1\"; \
}; f"
# Show status of all worktrees (unchanged)
wtst = "!git worktree list --porcelain | grep -E '^worktree|^branch' | paste - - | column -t"
# Create worktree from existing branch (local or remote)
wtco = "!f() { \
root=$(git rev-parse --show-toplevel); \
wtroot=$(dirname \"$root\")/$(basename \"$root\").worktrees; \
git worktree add --checkout \"$wtroot/$1\" \"$1\" 2>/dev/null || \
git worktree add --checkout \"$wtroot/$1\" \"origin/$1\"; \
}; f"
# Checkout PR into a worktree (depends on your git-checkout-pr-to-worktree script)
copr = !git-checkout-pr-to-worktree
# Update main branch
up = !git fetch origin main && git rebase origin/main
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[commit]
gpgsign = true
#template = /Users/jack/.stCommitMsg
[rerere]
enabled = 1
[init]
defaultBranch = main
[gpg]
format = ssh
[gpg "ssh"]
program = /Applications/1Password.app/Contents/MacOS/op-ssh-sign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment