chore: add gitmainbranch
This commit is contained in:
parent
6d02791a65
commit
7096b15e85
|
@ -30,12 +30,12 @@
|
||||||
cpls = !git cp $(git ls)
|
cpls = !git cp $(git ls)
|
||||||
d = diff
|
d = diff
|
||||||
dls = !git diff $(git branch | fzf)
|
dls = !git diff $(git branch | fzf)
|
||||||
dom = diff origin/master...
|
dom = !git diff origin/$(git mainbranch)...
|
||||||
drb = !git diff $(git rb)
|
drb = !git diff $(git rb)
|
||||||
ds = diff --staged
|
ds = diff --staged
|
||||||
f = fetch
|
f = fetch
|
||||||
fc = commit --allow-empty -m 'Initial commit'
|
fc = commit --allow-empty -m 'Initial commit'
|
||||||
fixom = !sh -c 'git fetch && git rebase -i --autosquash origin/master'
|
fixom = !sh -c 'git fetch && git rebase -i --autosquash origin/$(git mainbranch)'
|
||||||
fixup = rebase -i --autosquash
|
fixup = rebase -i --autosquash
|
||||||
l = log
|
l = log
|
||||||
l1 = log --oneline
|
l1 = log --oneline
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
lm = logme
|
lm = logme
|
||||||
logme = !sh -c 'git log --author=\"$(git config --get user.name)\"'
|
logme = !sh -c 'git log --author=\"$(git config --get user.name)\"'
|
||||||
ls = !git branch --format '%(refname:short)' | fzf
|
ls = !git branch --format '%(refname:short)' | fzf
|
||||||
|
mainbranch = !gitmainbranch
|
||||||
mls = !git merge $(git ls)
|
mls = !git merge $(git ls)
|
||||||
mr = !git merge $(git rb)
|
mr = !git merge $(git rb)
|
||||||
mrb = mr
|
mrb = mr
|
||||||
|
@ -57,7 +58,7 @@
|
||||||
plr = pull --rebase
|
plr = pull --rebase
|
||||||
ph = push -u origin HEAD
|
ph = push -u origin HEAD
|
||||||
pr = dom
|
pr = dom
|
||||||
prs = diff --stat origin/master
|
prs = !git diff --stat origin/$(git mainbranch)
|
||||||
ra = rebase --abort
|
ra = rebase --abort
|
||||||
rb = !git rev-parse --abbrev-ref --symbolic-full-name @{u}
|
rb = !git rev-parse --abbrev-ref --symbolic-full-name @{u}
|
||||||
rc = rebase --continue
|
rc = rebase --continue
|
||||||
|
@ -66,7 +67,7 @@
|
||||||
rh = reset --hard
|
rh = reset --hard
|
||||||
ri = rebase -i --autosquash
|
ri = rebase -i --autosquash
|
||||||
rils = !git rebase -i --autosquash $(git branch | fzf)
|
rils = !git rebase -i --autosquash $(git branch | fzf)
|
||||||
rom = !sh -c 'git fetch && git rebase origin/master'
|
rom = !sh -c 'git fetch && git rebase origin/$(git mainbranch)'
|
||||||
rr = !sh -c 'git fetch && git reset --hard $(git rb)'
|
rr = !sh -c 'git fetch && git reset --hard $(git rb)'
|
||||||
rv = revert
|
rv = revert
|
||||||
rvh = revert HEAD
|
rvh = revert HEAD
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Try to detect if the current repo has a main branch, or master.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if git branch -l | grep -q "main"; then
|
||||||
|
echo "main"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git branch -l | grep -q "master"; then
|
||||||
|
echo "master"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 1
|
Loading…
Reference in New Issue