Last active
March 28, 2024 00:55
-
-
Save neocotic/f06c8161a43f0c8b109c0033e83c5228 to your computer and use it in GitHub Desktop.
Git Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
co = checkout | |
cob = "!f() { git checkout -B $1; }; f" | |
br = branch | |
ci = commit | |
sh = stash | |
st = status | |
unstage = reset HEAD -- | |
last = log -1 HEAD | |
undo = checkout -- . | |
mast = checkout master | |
dev = checkout develop | |
bug = "!f() { git checkout -B \"bugfix/$1\"; }; f" | |
feat = "!f() { git checkout -B \"feature/$1\"; }; f" | |
hot = "!f() { git checkout -B \"hotfix/$1\"; }; f" | |
rel = "!f() { git checkout -B \"release/$1\"; }; f" | |
tidy = "!f() { git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done }; f" | |
tidymr = "!f() { git for-each-ref refs/heads/mr/* --format='%(refname)' | while read ref; do branch=${ref#refs/heads/}; git branch -D $branch; done }; f" | |
tidypr = "!f() { git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref; do branch=${ref#refs/heads/}; git branch -D $branch; done }; f" | |
# Bitbucket | |
prb = "!f() { git fetch -fu ${2:-$(git remote | grep ^upstream || echo origin)} refs/pull-requests/$1/from:pr/$1 && git checkout pr/$1; }; f" | |
# GitHub | |
pr = "!f() { git fetch -fu ${2:-$(git remote | grep ^upstream || echo origin)} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f" | |
# GitLab | |
mr = "!f() { git fetch -fu ${2:-$(git remote | grep ^upstream || echo origin)} refs/merge-requests/$1/head:mr/$1 && git checkout mr/$1; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment