bash : make gr accept head count.
This commit is contained in:
parent
f5f5d08ec4
commit
512732fcb3
|
@ -7,7 +7,6 @@ alias gst="git stash"
|
||||||
alias gd="git diff"
|
alias gd="git diff"
|
||||||
alias gc="git commit -m"
|
alias gc="git commit -m"
|
||||||
alias gch="git checkout"
|
alias gch="git checkout"
|
||||||
alias gr="git rebase -i"
|
|
||||||
alias gb="git branch"
|
alias gb="git branch"
|
||||||
alias gco="git checkout"
|
alias gco="git checkout"
|
||||||
alias gf="git fetch"
|
alias gf="git fetch"
|
||||||
|
@ -28,3 +27,21 @@ ga()
|
||||||
git diff $@
|
git diff $@
|
||||||
git add $@
|
git add $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# rebase by X commits or from root.
|
||||||
|
gr()
|
||||||
|
{
|
||||||
|
local base="${1}"
|
||||||
|
|
||||||
|
# rebase last 2 commits by default.
|
||||||
|
if [[ "${base}" = "" ]]; then
|
||||||
|
base="2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if 0, rebase from root. else from specified base.
|
||||||
|
if [[ "${base}" = "0" ]]; then
|
||||||
|
git rebase -i --root
|
||||||
|
else
|
||||||
|
git rebase -i HEAD~${base}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
Reference in a new issue