Created
December 4, 2023 16:09
-
-
Save miekg/a980f565d29e1bc3e766f5bb4302ed7b 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
# Fetch a mr/pr number from the hub and check it out in either mr-<num> or pr-<num> branch | |
pr = "!f() { \ | |
case $(git hubtype) in \ | |
github) git githubpr;; \ | |
gitlab) git gitlabpr;; \ | |
esac; \ | |
}; f" | |
gitlabpr = "!f() { pr=$(basename $1); git fetch origin pull/$pr/head:pr-$pr && git checkout pr-$pr; }; f" | |
githubpr = "!f() { mr=$(basename $1); git fetch origin merge-requests/$mr/head:mr-$mr && git checkout mr-$mr; }; f" | |
hubtype = "!f() { case $(git remote get-url origin) in *github*) echo github;; *gitlab*) echo gitlab;; esac; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment