#!/usr/bin/env bash
REV=$(uname -r)

# Installs git
if [[ $REV = *"ARCH"* ]]; then
    echo "ArchLinux"
    sudo pacman -S --needed git
elif hash apt-get 2>/dev/null; then
    echo "Debian"
    sudo apt-get install git

    # Installs git-extras
    sudo apt-get update
    sudo apt-get install git-extras
fi

# TODO: configure GPG keys
if type git >/dev/null 2>&1
then
    git config --global user.name "Ian Lai"
    git config --global user.email "ian@fyianlai.com"
fi

git config --global core.excludesfile ~/.gitignore_global
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"
git config --global rebase.autoStash true true
git config --global remote.origin.prune true

git config --global core.editor "nano"

#!/usr/bin/env bash
REV=$(uname -r)

# Installs git
if [[ $REV = *"ARCH"* ]]; then
    echo "ArchLinux"
    sudo pacman -S --needed git
elif hash apt-get 2>/dev/null; then
    echo "Debian"
    sudo apt-get install git

    # Installs git-extras
    sudo apt-get update
    sudo apt-get install git-extras
fi

# TODO: configure GPG keys
if type git >/dev/null 2>&1
then
    echo "Setting up git ..."

    git config --global user.name "Ian Lai"
    git config --global user.email "ian@fyianlai.com"

    git config --global core.excludesfile ~/.gitignore_global
    git config --global rebase.autoStash true true
    git config --global remote.origin.prune true

    git config --global core.editor "nano"
    git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"

    # https://github.com/so-fancy/diff-so-fancy
    git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
    git config --global color.ui true

    git config --global color.diff-highlight.oldNormal    "red bold"
    git config --global color.diff-highlight.oldHighlight "red bold 52"
    git config --global color.diff-highlight.newNormal    "green bold"
    git config --global color.diff-highlight.newHighlight "green bold 22"

    git config --global color.diff.meta       "yellow"
    git config --global color.diff.frag       "magenta bold"
    git config --global color.diff.commit     "yellow bold"
    git config --global color.diff.old        "red bold"
    git config --global color.diff.new        "green bold"
    git config --global color.diff.whitespace "red reverse"
fi


Improve git diff, and run configuration only if git is set-up
Improve git diff, and run configuration only if git is set-up
