aliases: Make aliases tolerant to main branch in git
This commit is contained in:
parent
2538ab1863
commit
7ebd50b761
@ -77,18 +77,22 @@ alias vpn="sudo openvpn --config $HOME/Nextcloud/#\ -\ Configs/rguiheneuf.ovpn"
|
||||
|
||||
alias gs='git status'
|
||||
alias gc='git checkout'
|
||||
alias gcm='git checkout master'
|
||||
alias gpl='git pull'
|
||||
alias gph='git push'
|
||||
alias gsu='git submodule update --init'
|
||||
alias gcp='git cherry-pick'
|
||||
|
||||
function gcm {
|
||||
( git rev-parse --verify origin/master > /dev/null 2>&1 ) && git checkout master
|
||||
( git rev-parse --verify origin/main > /dev/null 2>&1 ) && git checkout main
|
||||
}
|
||||
|
||||
alias add='git add'
|
||||
alias commit='git commit -m "To fixup"'
|
||||
alias cont='git rebase --continue'
|
||||
|
||||
# Git cleaners
|
||||
alias branch_clean='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d'
|
||||
alias branch_clean='git branch --merged | egrep -v "(^\*|master|main|dev)" | xargs git branch -d'
|
||||
alias tag_clean='git tag -l | xargs git tag -d && git fetch -t'
|
||||
|
||||
function git_parent {
|
||||
@ -152,13 +156,16 @@ function grbm {
|
||||
# Save current branch
|
||||
BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
|
||||
|
||||
# Checkout master & pull
|
||||
git checkout master
|
||||
# Checkout master/main & pull
|
||||
gcm
|
||||
git pull
|
||||
|
||||
# Save parent branch
|
||||
PARENT=$(git branch | grep \* | cut -d ' ' -f2)
|
||||
|
||||
# Back to previous branch
|
||||
git checkout ${BRANCH}
|
||||
git rebase --interactive master
|
||||
git rebase --interactive ${PARENT}
|
||||
}
|
||||
|
||||
function grbi {
|
||||
@ -189,8 +196,16 @@ function ga {
|
||||
}
|
||||
|
||||
function gam {
|
||||
git autofixup master
|
||||
git rebase --interactive --autosquash master
|
||||
# Checkout master/main & pull
|
||||
gcm
|
||||
|
||||
# Save parent branch
|
||||
PARENT=$(git branch | grep \* | cut -d ' ' -f2)
|
||||
|
||||
git checkout -
|
||||
|
||||
git autofixup ${PARENT}
|
||||
git rebase --interactive --autosquash ${PARENT}
|
||||
}
|
||||
|
||||
function gai {
|
||||
|
Loading…
x
Reference in New Issue
Block a user