Developer

Some useful notes

for Vim.

yy:copy the line
dd:delete the line
p:to paste the copied or deleted text after the current line
P:to paste the copied or deleted text before the current line

Some useful commands

//list the size of file under this directory
du -h --max-depth=1 | sort -hr 
//grep thread that has name "ChildProcessorLinkProcess" and kill them
ps -ef | grep ChildProcessorLinkProcess | grep -v grep | awk '{print $2}' | xargs kill
//find files with name 'naught.*' and rm it
find . -name "naught.*" -exec rm -i {} \;

Git configuration for short cut comments

[core]
    editor= /usr/bin/vim

[user]
    email = homerzhm@gmail.com
    name = Homer Zuo

[color]
    branch = auto
    diff = auto
    status = auto

[color "branch"]
    current = red reverse
    local = yellow
    remote = green

[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
 
[color "status"]
    added = yellow
    changed = green
    untracked = cyan
 
[alias]
 
    st = status -s
    cl = clone
    ci = commit -s
    cm = commit -m
    cma = commit -a -m
    cas = commit --amend -s
    amend = commit --amend
    caa = commit -a --amend -C HEAD
    cif = commit --fixup
    filelog = log -u
    fl = log -u
 
    ai = add --interactive
 
    co = checkout
    br = branch 
    #"!git branch -ra | grep -v done"
    bra = branch -ra
    #list commands
    le = log --oneline --decorate
    ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
    ls1 = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
    lds = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]\\ %C(green)%ad" --decorate --date=short --graph
    ls = log --pretty=format:"%C(green)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]\\ %C(yellow)[%ad]" --decorate --date=relative
    #show file change in commit id passed in arguement
    lc  = "!f() { git ll "$1"^.."$1"; }; f"
    lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
    ld = log --pretty=format:"%C(yellow)%h\\ %Creset%s%Cred\\ [%cn]\\ %ad%Cblue%d" --decorate --abbrev-commit --date=relative
    #list all aliases
    la = "!git config -l | grep alias | cut -c 7-"
    diff = diff --word-diff
    d = diff --word-diff
    dc = diff --cached
    #list modified files in last commit
    dl = "!git ll -1"
    #diff last commit
	dlc = diff --cached HEAD^
    #show code changes in last commit
    dr  = "!f() { git diff "$1"^.."$1"; }; f"
    diffr  = "!f() { git diff "$1"^.."$1"; }; f"
    branch = branch -ra
    bmuser = branch -a --list *smitesh.patel* --merged
    bnmuser = branch -a --list *smitesh.patel* --no-merged
    buser = branch -a --list $1
 
    #reset commands
    r = reset
    r1 = reset HEAD^
    r2 = reset HEAD^^
    rh = reset --hard
    rh1 = reset HEAD^ --hard
    rh2 = reset HEAD^^ --hard
 
    #git svn
    svnr = svn rebase
    svnd = svn dcommit
    svnl = svn log --oneline --show-commit
 
    #stash
    sl = stash list
    sa = stash apply
    ss = stash save
 
    cp = cherry-pick
    grep = grep -Ii
    gr = grep -Ii

    #grep from root foflder
    gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
 
    #grep on filename
    f = "!git ls-files | grep -i"
 
    #rename branch tree to done-
	done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
 
    lasttag = describe --tags --abbrev=0
    lt = describe --tags --abbrev=0
 
    #merges
    ours = "!f() { git co --ours $@ && git add $@; }; f"
	theirs = "!f() { git co --theirs $@ && git add $@; }; f"
 
    #push
	pushremote = "!f() { git push -f origin sp/"$1":dev/"$USER"/"$1"; }; f"
	deleteremote = "!f() { git push -f origin :dev/"$USER"/"$1"; }; f"
 
	updateSubmodules = "submodule foreach 'git fetch origin --tags; git checkout master; git pull' && git pull && git submodule update --init --recursive"

[push]
	default = matching

[rerere]
	enabled = true

[mergetool]
	keepBackup = false

It will keep Updating…

Leave a Reply