GIT

Config

Alias

alias.br=branch
alias.co=checkout
alias.d=diff --word-diff=color
alias.g0=log --oneline --graph --all --decorate --full-history
alias.g=log --graph --full-history --format="%C(auto)%h %Cgreen%<(7,trunc)%cN%C(auto)%d %s"
alias.ga=log --graph --all --full-history --format="%C(auto)%h %Cgreen%<(7,trunc)%cN%C(auto)%d %s"
alias.gv=log --graph --all --full-history --format="%C(auto)%h %t %Cgreen%<(7,trunc)%cN %Cred%ad%C(auto)%d %s" --date=format-local:"%Y-%m-%d %H:%M:%S"
alias.s=status -sb
alias.cat=cat-file -p
alias.type=cat-file -t

Tips/Trick

Changing line endings in repository

Based on StackOverflow Answer.

# change settings
git config --local --replace-all core.autocrlf true

# clear Index
git rm --cached -r .

# re-add files
git add .

# commit
git commit -m "crlf fix"

Patch transfer

cd from
git format-patch --stdout master^ > .../file.patch

cd to
# git apply --check .../file.patch
git am .../file.patch

Putty/Pageant

GIT_SSH='C:\Program Files (x86)\PLINK.EXE'

Starting KDiff3 as Merge Tool on the Git GUI

This will register KDiff3 as an external Tool on the GUI.

git config --global --replace-all merge.tool kdiff3
git config --global --replace-all mergetool.kdiff3.cmd '"C:\\Program Files\\KDiff3\\kdiff3" $BASE $LOCAL $REMOTE -o $MERGED'
git config --global --replace-all guitool.KDiff3.cmd 'git mergetool'

Uncompress file (Windows)

openssl zlib -d < {file}

Update branch without changing to it

git fetch <remote> <source>:<destination>

This only works with fast-forward merges [1].
Example:
git fetch origin master:master

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.