Saturday, 1 December 2012

GIT - Config File Changes with Aliases

 There are THREE files where git config search for configuration options.

$GIT_DIR/config
Repository specific configuration file. (The filename is relative to the repository root, not the working directory.)
~/.gitconfig
User-specific configuration file. Also called "global" configuration file.
$(prefix)/etc/gitconfig
System-wide configuration file.
 We can override the config file rules either by command line options or by environment variables.

The --global and the --system options will limit the file used to the global or system-wide file respectively.

Sample GIT Config File Rules - Which we can override in any one of the above location (.git/config).

[user]
    name = YourFirstname Lastname
    email = yourmailid
[color]
    ui = auto
[color "branch"]
    current = yellow 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
    com = commit
    br = branch
    co = checkout
    df = diff
    dc = diff --cached
    lg = log -p
    lol = log --graph --decorate --pretty=oneline --abbrev-commit
    lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
    ls = ls-files
[core]
    excludesfile = /Users/gitusername/.gitignore
    filemode = false
    mergeoptions = ff--only
[difftool "sourcetree"]
    cmd = opendiff \"$LOCAL\" \"$REMOTE\"
    path =
[mergetool "sourcetree"]
    cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
    trustExitCode = true

No comments:

Post a Comment

Thank you so much for providing your valuable feedback. I will will look into them and update my skills & technologies accordingly.