Commandes Git Shothand
# ----------------------
# Git Aliases
# ----------------------
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add --all'
alias gau='git add --update'
alias gb='git branch'
alias gbd='git branch --delete '
alias gc='git commit'
alias gcm='git commit --message'
alias gcf='git commit --fixup'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcom='git checkout master'
alias gcos='git checkout staging'
alias gcod='git checkout develop'
alias gd='git diff'
alias gda='git diff HEAD'
alias gi='git init'
alias glg='git log --graph --oneline --decorate --all'
alias gld='git log --pretty=format:"%h %ad %s" --date=short --all'
alias gm='git merge --no-ff'
alias gma='git merge --abort'
alias gmc='git merge --continue'
alias gp='git pull'
alias gpr='git pull --rebase'
alias gr='git rebase'
alias gs='git status'
alias gss='git status --short'
alias gst='git stash'
alias gsta='git stash apply'
alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop'
alias gsts='git stash save'
# ----------------------
# Git Functions
# ----------------------
# Git log find by commit message
function glf() { git log --all --grep="$1"; }
#USAGE
for example, instead of git add assets/css/screen.css, you can run:
ga assets/css/screen.css
or instead of git checkout -b <branch-name>:
gcob <branch-name>
gld is a detailed, one-line view of git log:
$ gld
dba068d 2015-02-11 Remove stop propagation.
37372ec 2015-02-11 Remove third-party Twitter widget.js completely and replace with intent link.
7d1a5d2 2015-02-11 Uglify critical in production task.
By default gm, the alias for git merge, defaults to --no-ff (no fast-forward)—many times I have more than 1 feature branch in development, each of those branches has more than 1 commit, and I feel that the history of the merges are important.
Occasionally I want to search for a commit by the commit message. Using glf:
glf "commit message"
You should get an output like follows:
$ glf "logic"
commit 95ed7d5b6f6d168047fd8ddc86579ce09ca39394
Author: Jonathan Suh <[email protected]>
DreamCoder