Friday, October 16, 2015

Global GIT Configuration: ~/.gitconfig

#vi ~/.gitconfig
[alias]
    st = status
    ci = commit
    br = branch
    co = checkout
    df = diff
    dc = diff --cached
    lg = log -p
    who = shortlog -s --
    changes=diff --name-status -r
    diffstat=diff --stat -r
    logtree = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
    last = log -1 HEAD
    tree = log --graph --decorate --pretty=oneline --abbrev-commit
     # format %cd with --date=short cuts the timezone in log 
    ll = log --graph --pretty=format:\"%C(yellow)%h %C(green)(%cd)%C(auto)%d %Creset%s [%an]\" --date=short
    logtree = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
 
[user]
        email = emailid@email.com
        name = Name S
[color]
        ui = auto
[diff]
        tool = vimdiff



# run
git config --global diff.tool vimdiff  #to defibe difftool
git difftool    # launch vimdiff with changes

This will add alias "tree"
git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"

For external file diff usage
[diff]
    external = /bin/git-meld.sh


$ cat /home/<dir>/bin/git-meld.sh
#!/bin/bash

meld $2 $5





No comments: