Skip to content

Instantly share code, notes, and snippets.

@jadenlemmon
Last active November 4, 2021 14:30
Show Gist options
  • Save jadenlemmon/87587e4d1ba21bddace80d0b092ca407 to your computer and use it in GitHub Desktop.
Save jadenlemmon/87587e4d1ba21bddace80d0b092ca407 to your computer and use it in GitHub Desktop.
Git alias config file
[alias]
branch-name = "!git rev-parse --abbrev-ref HEAD"
c = checkout
cb = checkout -b
s = status
# push the current branch
pub = "!git push -u origin $(git branch-name)"
# open a pr in github
open = "!f() { open \"$(git ls-remote --get-url $(git config --get branch.$(git branch --show-current).remote) | sed 's|[email protected]:\\(.*\\)$|https://github.com/\\1|' | sed 's|\\.git$||')/compare/$(git config --get branch.$(git branch --show-current).merge | cut -d / -f 3-)?expand=1\"; }; f"
last = log -1 HEAD --stat
# shorthand add all files and commit
ac = "!f() { git add .; git commit -m \"$*\"; };f"
# add all files with a random commit msg
rc = "!git add -A && git commit -am \"$(curl -s http://whatthecommit.com/index.txt)\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment