qishi604 / notes

0 stars 0 forks source link

git aliases #11

Open qishi604 opened 6 years ago

qishi604 commented 6 years ago

~/.gitconfig

[alias]
    # Shortening aliases
    co  = checkout       # Checkout a branch
    b   = branch
    cob = checkout -b    # Checkout a new not yet existing branch
    f   = fetch -p       # Fetch from a repository and prune any remote-tracking references that no longer exist on the remote.
    c   = commit         # Commit you changes
    p   = push           # Push you changes to a remote
    ba  = branch -a      # List both remote-tracking branches and local branches.
    bd  = branch -d      # Delete a branch only if it has been merged
    bD  = branch -D      # Force delete a branch
    dc  = diff --cached  # Display the staged changes

    # Feature improving aliases
    st = status -sb
    a = add -p

    # complex alias
    plog = log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'
    lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
    tlog = log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative
    rank = shortlog -sn --no-merges
    bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d"

...