Skip to content

Instantly share code, notes, and snippets.

@benrowe
Last active July 31, 2025 02:24
Show Gist options
  • Save benrowe/3ab0634d25ed95ba0abd36775e6a2c9e to your computer and use it in GitHub Desktop.
Save benrowe/3ab0634d25ed95ba0abd36775e6a2c9e to your computer and use it in GitHub Desktop.
Local machine config
alias dk_restart="osascript -e 'quit app \"Docker\"' && open -a Docker"
alias dkps="docker ps --format '{{.ID}} - {{.Names}} - {{.Status}} - {{.Image}}'"
alias dk="docker"
alias dkl="docker logs"
alias dklf="docker logs -f"
alias dki="docker images"
alias dks="docker service"
alias dkrm="docker rm"
alias dkrmi="docker rmi"
[user]
name = {user.fullname}
email = {user.email}
[commit]
template = /Users/{user.login}/.stCommitMsg
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
[push]
default = current
[pull]
ff = only
[init]
defaultBranch = master
[rebase]
autoStash = true
[alias]
## Lazygit!!
lazy = "!lazygit"
## Show commit history as a graph
ls = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
## Show linear commit history with file stats
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
## Search commit content for a string
search = "!f() { git log -p -S \"$1\" -- \"${2:-.}\"; }; f"
## Show commit history for a specific file
filelog = log -u
## Alias for filelog
fl = log -u
## Stage all changes
a = add
## Stage changes interactively
ap = add -p
## Commit with an inline message
cm = commit -m
## Amend the previous commit
ca = commit --amend
## Clean untracked files interactively
cln = clean -i
## Apply a specific commit from another branch
cp = cherry-pick
## Fetch changes from remote
f = fetch
## Push changes to remote
p = push
## Force push safely, without overwriting others' work
pf = push --force-with-lease
## Show changes in the working directory
d = diff
## Show diff statistics
ds = diff --stat
## Show staged changes (diff against HEAD)
dc = diff --cached
## Diff current branch against the develop branch
dd = diff develop..HEAD --name-status
## Show commit statistics by author
stat = shortlog -s -n --all --no-merges
## Show short repository status
s = status -s -uall
## Checkout a branch or commit
co = checkout
## Create and checkout a new branch
cob = checkout -b
## Checkout file changes interactively
cop = checkout -p
## List all stashed changes
stl = stash list
## Force delete a local branch
del = branch -D
## List local branches, sorted by most recent
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
## List all local and remote branches by date
ba = "!git for-each-ref --format='%(authordate:format:%Y-%m-%d)%09%(authorname)%09%(objectname:short)%09%(refname)' refs | grep -i 'heads\\|remotes' | sed -e 's-refs/heads/--' | sed -e 's-refs/remotes/--'"
## List only my local and remote branches by date
bam = "!git for-each-ref --format='%(authordate:format:%Y-%m-%d)%09%(authorname)%09%(objectname:short)%09%(refname)' refs | grep -i 'heads\\|remotes' | grep '$(git config user.name)' | sed -e 's-refs/heads/--' | sed -e 's-refs/remotes/--'"
## Push current branch to origin and set as upstream
track = "!git push -u origin $(git symbolic-ref --short HEAD)"
## Undo the last commit but keep all changes staged
undo-commit = reset --soft HEAD~1
## Show commits ahead/behind remote master
ahead = "!git rev-list --left-right --count origin/master...HEAD | awk '{print \"behind: \"$1, \"ahead: \"$2}'"
## List all configured git aliases
la = "!git config -l | grep '^alias\\.' | cut -c 7- | awk '{ pos = index($0, \"=\"); printf(\"\\033[1;32m%s\\033[0m=%s\\n\", substr($0, 1, pos-1), substr($0, pos+1)) }'"
## Prune remote and interactively clean up merged branches
tidy = "!git remote prune origin && git branch --merged >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches"
## Rebase current branch onto origin/develop
rbod = rebase origin/develop
## Rebase current branch onto origin/master
rbom = rebase origin/master
[core]
editor = vim
ZSH_THEME="af-magic"
plugins=(
git
zsh-autosuggestions
)
@sidouglas
Copy link

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment