Skip to content

Git workflow for MPICH development

Hui Zhou edited this page Mar 5, 2021 · 3 revisions

Command aliases

Some of aliases (and functions) in my .bashrc that may be useful for other developers --

alias gitlog='git log -n 25 --format="format:%h %ad %s" --date="format:%m/%d %H:%M"'

alias gitpick='git cherry-pick'
alias gitupdate='git checkout main && git pull && git push gh-hzhou && git checkout @{-1}'
alias gitbranch="git rev-parse --abbrev-ref HEAD"
alias gitpush="git stash"
alias gitpop="git stash pop"
alias git_pr_push="git push gh-hzhou"
alias gitpickaxe="git log -p -S"
alias gitfile="git log --follow --"
alias gitdummy="touch dummy && git add dummy && git commit -m '---- START HERE ----'"

alias gitri="git rebase -i"
alias git_last_merg="git log -1 --merges --pretty=format:'%h'"
alias gitrc="git rebase --continue"
alias gitrca="git add --all && git rebase --continue"
alias gitra="git commit --amend"
alias gitraa="git commit -a --amend"

alias git_branch_delete="git branch --merged main | grep -v main | xargs git branch -D"

function git_branch_delete_remote {
    git fetch --prune gh-hzhou
    git branch -r --merged main --list 'gh-hzhou/*' | sed 's/gh-hzhou\///' | grep -v main | xargs git push gh-hzhou --delete
}

function gitrii {
    local commit=`git log -1 --merges --pretty=format:'%h'`
    git rebase -i $commit
}
function git_reset_last_merge {
    local commit=`git log -1 --merges --pretty=format:'%h'`
    git reset --hard $commit
}
Clone this wiki locally