Git

aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springen

Intro

Git is a version control system. It's more powerful than svn and quite confusing (for starters).

Workshops

Workshop #1

2012-10-08: YAGT Talk by HaSch (sources@github)

First Steps

Git Installation

Linux

   sudo apt-get install git

UI (there are several possibilities)

   sudo apt-get install qgit git-cola gitk tig

OS X

MS Windows

Git Introduction / Tutorial

git clone fromsomeurl
or
git init
git pull --rebase
git add file
git commit -m "holla"
git push
git stash # stashes uncommited changes away
git stash apply # gets stash back and applies it
git branch --track thebranch origin/thebranch

switch to a remote branch and track it

sample ~/.gitconfig

[mergetool]
keepBackup = 0

[user]
name = Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯
email = daxim@cpan.org
signingkey = 0xE5F4D07A

[color]
ui = auto

[diff "opendocument"]
textconv = odt2txt

[diff "excel"]
textconv = xls2csv

[diff "perl"]
xfuncname = ^\\s*(sub.*)

[alias]
# commands listed in order of amount of usage
s = status -s
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# also rarely: git l --all
raw = show --format=raw
cp = cherry-pick
mt = mergetool -t kdiff3
a = add
d = diff # also: git d -w
up = pull --rebase
# git svn fetch
re = svn rebase
ba = branch -a
dc = diff --cached # also: git dc -w
c = commit
rh = reset --hard
co = checkout
ca = commit --amend
dco = svn dcommit --user=daxim
# git push
st = stash
pop = stash pop
rc = rebase --continue
# git reflog
# git init
# git rebase
# git am
# git tag
f = format-patch # git -f 1 ; mail 000*.patch
wu = log --stat origin..@{0} # what will be pushed upstream? overview
wup = log -p origin..@{0} # what will be pushed upstream? treediff
# git mergetool
# git fetch
# git merge
pack = gc --aggressive
check = fsck --unreachable --root --tags --full --strict --lost-found
ai = add --interactive
ri = rebase --interactive
b = branch
# git remote
# git mv
ap = add --patch
r = reset
ls = stash list
sh = stash show
au = shortlog -s # authors
# unpack-refs = "!bash -c 'IFS=$''\\n''; for f in $(git show-ref --heads); do /bin/echo ''Writing  '' $(echo $f | cut -c42-); echo $(echo $f | cut -c1-40) > \"${GIT_DIR:-.git}/$(echo $f | cut -c42-)\"; done'"
expire1 = reflog expire --expire=now --all
expire2 = gc --prune=now

[gui]
fontui = -family \"DejaVu Sans\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0
fontdiff = -family \"DejaVu Sans Mono\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0

[github]
user = daxim
token = affeaffeaffeaffeaffeaffeaffeaffe