Setting up & Operating GIT repositories

Client Setup

identify yourself,

#git config --global --edit
git config
git config "your name or user@hostname"
git config
git config "your@email"

some defaults,

#git config --global push.default simple
#git config --global core.editor elvis

Basic usage

see the changed files

git log
git show COMMIT --stat

see all the diffs

#git log -p
git show COMMIT

Dirty Tweaks

for docs, scripts & configs you do not want to track like hell, those are some handy GIT aliases,

git config --global 'commit -a --allow-empty-message -m ""'
git config --global 'commit --allow-empty-message -m ""'
git config --get-regexp alias

to push the devil even harder, one might use those Shell aliases,

alias push='git nc && git push'
alias stat='git diff --stat --cached origin/master'

Fetching a repository


git clone
#git clone

Gitlab on-premises,

git clone ssh://git@gitsrv/home/git/project.git
#git clone http://git@gitsrv/home/git/project.git
#git clone https://git@gitsrv/home/git/project.git

Using GIT in production

update the list of branches, switch to the new revision,

    git fetch -a
    git checkout release-1.1.0
    git pull

and restart the application.


no certificates

I am being lazy here – for testing and internal purposes on possibly embedded systems that are missing certs, when you do not want to play with PKI but actually play with something else,

git config --global http.sslVerify false

Now for example on NetBSD, if you want to fix this the right way,

uname -r
echo $PKG_PATH
pkg_add mozilla-rootcerts
cp -i /usr/share/examples/openssl/openssl.cnf /etc/openssl
ll /etc/openssl/certs/
mozilla-rootcerts install
ll /etc/openssl/certs/ca-certificates.crt
curl -I

Enabling RAW control chars

If you got shit like this when doing git diff,


==> enable “raw” control characters in your PAGER,

git config --global core.pager "less -r"


How to show what a commit did?

8.1 Customizing Git - Git Configuration

Show File Diffs When Viewing Git Log

The Git Hater’s Guide

10 things I hate about Git

List Git aliases

How to see the changes in a Git commit?

Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml