Skip to content

Instantly share code, notes, and snippets.

@ytyng
Last active May 22, 2019 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ytyng/f95f7946fa6775a8105c715c603b6aa1 to your computer and use it in GitHub Desktop.
Save ytyng/f95f7946fa6775a8105c715c603b6aa1 to your computer and use it in GitHub Desktop.
# git
alias A="git add ."
alias S="git branch -v; git status"
alias SU="git submodule update -i"
alias C="git commit"
alias CO="git checkout"
alias B="git branch -vv"
alias LL="git log --graph --date=iso --decorate --name-status"
alias L="git log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short"
alias LLL='git log --graph --decorate $(git rev-list -g --all)'
alias D="git diff"
alias DD="git diff --cached"
alias gf="git-flow"
P(){
BRANCH_NAME=`git-get-branch-name`
if [ "${BRANCH_NAME}" ]; then
git fetch --prune
git pull --prune origin ${BRANCH_NAME}
fi
}
PR(){
# リベースしない
BRANCH_NAME=`git-get-branch-name`
if [ "${BRANCH_NAME}" ]; then
git fetch --prune
git pull --rebase --prune origin ${BRANCH_NAME}
fi
}
PP(){
BRANCH_NAME=`git-get-branch-name`
if [ "${BRANCH_NAME}" ]; then
#git pull --rebase --prune origin ${BRANCH_NAME}
git push origin ${BRANCH_NAME}
fi
}
# ブランチ名を取得する
git-get-branch-name(){
HEAD_SYMBOL=`git symbolic-ref HEAD`
BRANCH_NAME=${HEAD_SYMBOL/refs\/heads\//}
if [ "${HEAD_SYMBOL}" != "${BRANCH_NAME}" ]; then
echo -n ${BRANCH_NAME}
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment