Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save guilhermeprokisch/a76a2353c73b3b7550cd161910bb5261 to your computer and use it in GitHub Desktop.
Save guilhermeprokisch/a76a2353c73b3b7550cd161910bb5261 to your computer and use it in GitHub Desktop.
Git alias
[alias]
cof = !git for-each-ref --format='%(refname:short)' refs/heads | fzf | xargs git checkout
c = !git add --all && git commit -m
ss = !git status -s
l = !git log --pretty=format:'%C(white)%s ⋮ %C(cyan)%cn ⋮ %C(green)%cr ⋮ %C(blue)%h ⋮ %C(red)%d'
r = !git restore --staged
amend=!git add --all && git commit --amend --no-edit
count = !git short shortlog -s --grep
; s = !zsh -c 'source ~/.config/zsh/zshrc && gitcommitplus'
s = !git status
build = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"build(${2}): ${@:3}\"; else git commit -m \"build: ${@}\"; fi }; a"
chore = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"chore(${2}): ${@:3}\"; else git commit -m \"chore: ${@}\"; fi }; a"
ci = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"ci(${2}): ${@:3}\"; else git commit -m \"ci: ${@}\"; fi }; a"
docs = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"docs(${2}): ${@:3}\"; else git commit -m \"docs: ${@}\"; fi }; a"
feat = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"feat(${2}): ${@:3}\"; else git commit -m \"feat: ${@}\"; fi }; a"
fix = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"fix(${2}): ${@:3}\"; else git commit -m \"fix: ${@}\"; fi }; a"
perf = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"perf(${2}): ${@:3}\"; else git commit -m \"perf: ${@}\"; fi }; a"
refactor = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"refactor(${2}): ${@:3}\"; else git commit -m \"refactor: ${@}\"; fi }; a"
revert = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"revert(${2}): ${@:3}\"; else git commit -m \"revert: ${@}\"; fi }; a"
style = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"style(${2}): ${@:3}\"; else git commit -m \"style: ${@}\"; fi }; a"
test = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"test(${2}): ${@:3}\"; else git commit -m \"test: ${@}\"; fi }; a"
wip = "!a() { if [[ \"$1\" == \"-s\" || \"$1\" == \"--scope\" ]]; then git commit -m \"wip(${2}): ${@:3}\"; else git commit -m \"wip: ${@}\"; fi }; a"
ignore = "!gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}; gi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment