Skip to content

Instantly share code, notes, and snippets.

@TravisBernard
Last active September 29, 2023 20:40
Show Gist options
  • Save TravisBernard/aa48ac063b6619e0b6c94521aa36f293 to your computer and use it in GitHub Desktop.
Save TravisBernard/aa48ac063b6619e0b6c94521aa36f293 to your computer and use it in GitHub Desktop.
My favorite git aliases
[alias]
aa = add --all ; add all files from workspace to stage
ap = add -p ; interactively add files from workspace to stage
c = commit -m ; commit with message - usage git c "message here"
f = fetch --all --prune --tags; update local branch index from remotes
s = status
b = branch
ch = checkout
lo = log --oneline ; show commits in abbreviated format
home = checkout main ; checkout main branch
mkbr = checkout -b ; make branch
rmbr = branch -D ; remove branch
ds = diff --staged ; show changes that are staged but not yet committed
cr = "!git fetch --all --tags --prune && git checkout tags/$1 -b $1 #" ; checkout release - usage git cr 1.17.300
fd = "!git fetch --all && git diff --name-only $1..origin/main #" ; file diff between a release and the main branch - usage git fd 1.17.300
ld = "!git fetch --all && git log --oneline $1..origin/main #" ; log diff between a release and the main branch - usage git ld 1.17.300
brprune = "!git branch | grep -v "main" | grep -v "^*" | xargs git branch -D #" ; remove all local branches except main and current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment