This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config
23 lines (17 loc) · 1.87 KB
/
config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[alias]
branch-name = rev-parse --abbrev-ref HEAD
branch-remote = rev-parse --abbrev-ref --symbolic-full-name @{u}
ensure-arg = "!f() { if [ -z \"$1\" ]; then echo \"Missing argument no. 1\"; exit 1; fi }; f"
ensure-clean = "!f() { if [ -n \"$(git status --short)\" ]; then echo \"The repo has changes exiting with an error.\" && git status && exit 1; fi }; f"
pull-other = "!f() { git ensure-arg $1 && OLD_BR=`git branch-name` && git ensure-clean && git checkout $1 && git pull && git checkout $OLD_BR; }; f"
rebase-master = "!f() { git pull-other master && git rebase $@ master; }; f"
diff-fetch-remote = "!f() { git fetch --all && git diff `git branch-remote` $@; }; f"
diff-remote = "!f() { git diff `git branch-remote` $@; }; f"
ospr-check-remote = "!f() { git ensure-arg $1 && if ! git config remote.$1.url > /dev/null; then echo \"Please make sure you have a git remote repo added and it is named '$1'\"; exit 1; fi }; f"
ospr-check = "!git ospr-check-remote upstream && git ospr-check-remote origin"
ospr-check-ospr-branch = "!f() { BRANCH_PREFIX=\"$(git branch-remote | grep -o ^origin/)\"; git ospr-check && if [ -z \"$BRANCH_PREFIX\" ]; then echo \"This branch is not an open source pull request branch.\"; exit 1; fi }; f"
ospr-nbr = "!f() { git ospr-check && git ensure-arg $1 && git pull-other upstream-master && git checkout -b $1 upstream-master && git push -u origin $1; }; f"
ospr-fetch-rebase = "!f() { git ospr-check-ospr-branch && git pull-other upstream-master && git rebase $@ upstream-master; }; f"
ospr-rebase = "!f() { git ospr-check-ospr-branch && git rebase $@ upstream-master; }; f"
ospr-diff = "!f() { git ospr-check-ospr-branch && git diff $(git merge-base `git branch-name` upstream/master) $@; }; f"
checkout-ospr-branch = "!f() { git ensure-arg $1 && git fetch upstream pull/$1/head:ospr-branch-$1 && git checkout ospr-branch-$1; }; f"